summaryrefslogtreecommitdiffstats
path: root/Modules/CheckLibraryExists.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/CheckLibraryExists.cmake')
-rw-r--r--Modules/CheckLibraryExists.cmake7
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake
index a170e7a..59fca0a 100644
--- a/Modules/CheckLibraryExists.cmake
+++ b/Modules/CheckLibraryExists.cmake
@@ -26,6 +26,9 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
+
+
MACRO(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
SET(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION
@@ -33,8 +36,10 @@ MACRO(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY}")
SET(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY})
IF(CMAKE_REQUIRED_LIBRARIES)
+ # this one translates potentially used imported library targets to their files on disk
+ CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
SET(CHECK_LIBRARY_EXISTS_LIBRARIES
- ${CHECK_LIBRARY_EXISTS_LIBRARIES} ${CMAKE_REQUIRED_LIBRARIES})
+ ${CHECK_LIBRARY_EXISTS_LIBRARIES} ${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES})
ENDIF(CMAKE_REQUIRED_LIBRARIES)
TRY_COMPILE(${VARIABLE}
${CMAKE_BINARY_DIR}