cmake: Fix possible redefinition of imported target in FindALSA

This commit is contained in:
Florent Castelli 2017-02-06 04:18:51 +01:00
parent 834ec372cc
commit e211cdd11d

View File

@ -47,11 +47,13 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALSA
if(ALSA_FOUND)
set( ALSA_LIBRARIES ${ALSA_LIBRARY} )
set( ALSA_INCLUDE_DIRS ${ALSA_INCLUDE_DIR} )
add_library(ALSA::ALSA UNKNOWN IMPORTED)
set_target_properties(ALSA::ALSA PROPERTIES
IMPORTED_LOCATION ${ALSA_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIR}
)
if(NOT TARGET ALSA::ALSA)
add_library(ALSA::ALSA UNKNOWN IMPORTED)
set_target_properties(ALSA::ALSA PROPERTIES
IMPORTED_LOCATION ${ALSA_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIR}
)
endif()
endif()
mark_as_advanced(ALSA_INCLUDE_DIR ALSA_LIBRARY)