diff options
Diffstat (limited to 'Modules/CheckCXXSourceRuns.cmake')
-rw-r--r-- | Modules/CheckCXXSourceRuns.cmake | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake index ace60d1..cd68d57 100644 --- a/Modules/CheckCXXSourceRuns.cmake +++ b/Modules/CheckCXXSourceRuns.cmake @@ -24,13 +24,18 @@ # (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_CXX_SOURCE_RUNS SOURCE VAR) IF("${VAR}" MATCHES "^${VAR}$") - SET(MACRO_CHECK_FUNCTION_DEFINITIONS + SET(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") 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_CXX_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") ELSE(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES) ENDIF(CMAKE_REQUIRED_LIBRARIES) @@ -62,9 +67,9 @@ MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR) IF("${${VAR}_EXITCODE}" EQUAL 0) SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}") MESSAGE(STATUS "Performing Test ${VAR} - Success") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" - "${OUTPUT}\n" + "${OUTPUT}\n" "Return value: ${${VAR}}\n" "Source file was:\n${SOURCE}\n") ELSE("${${VAR}_EXITCODE}" EQUAL 0) @@ -75,9 +80,9 @@ MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR) ENDIF(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") MESSAGE(STATUS "Performing Test ${VAR} - Failed") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n" - "${OUTPUT}\n" + "${OUTPUT}\n" "Return value: ${${VAR}_EXITCODE}\n" "Source file was:\n${SOURCE}\n") ENDIF("${${VAR}_EXITCODE}" EQUAL 0) |