cmake: Fix possible redefinition of imported target in FindOpenSLES

This commit is contained in:
Florent Castelli 2017-02-06 04:18:59 +01:00
parent e211cdd11d
commit 3dfae32963
1 changed files with 7 additions and 5 deletions

View File

@ -18,11 +18,13 @@ find_package_handle_standard_args(OpenSLES DEFAULT_MSG
OPENSLES_LIBRARY OPENSLES_INCLUDE_DIR)
if(OpenSLES_FOUND)
add_library(OpenSLES::OpenSLES UNKNOWN IMPORTED)
set_target_properties(OpenSLES::OpenSLES PROPERTIES
IMPORTED_LOCATION ${OPENSLES_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${OPENSLES_INCLUDE_DIR}
)
if(NOT TARGET OpenSLES::OpenSLES)
add_library(OpenSLES::OpenSLES UNKNOWN IMPORTED)
set_target_properties(OpenSLES::OpenSLES PROPERTIES
IMPORTED_LOCATION ${OPENSLES_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${OPENSLES_INCLUDE_DIR}
)
endif()
endif()
mark_as_advanced(OPENSLES_INCLUDE_DIR OPENSLES_LIBRARY )