diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-02-09 09:34:37 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-02-22 13:35:39 (GMT) |
commit | 236133e79e2d047810eeba90915e38d9861e2a22 (patch) | |
tree | 25265f06106cbc0403c53f6705e14baac002687c /Modules/CheckFunctionExists.cmake | |
parent | 1c0597c25bf69a9c73e3d4f6ab68d16b5e56a271 (diff) | |
download | CMake-236133e79e2d047810eeba90915e38d9861e2a22.zip CMake-236133e79e2d047810eeba90915e38d9861e2a22.tar.gz CMake-236133e79e2d047810eeba90915e38d9861e2a22.tar.bz2 |
Handle targets in the LINK_LIBRARIES of try_compile.
Imported targets are re-exported so that they can be used by the
try_compile generated code with target_link_libraries.
This makes the use of the cmake_expand_imported_targets macro
obsolete. The macro is not able to expand the generator expressions
which may appear in the IMPORTED_LINK_INTERFACE_LIBRARIES content.
Instead it just sees them as 'not a target'.
Diffstat (limited to 'Modules/CheckFunctionExists.cmake')
-rw-r--r-- | Modules/CheckFunctionExists.cmake | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake index 3f952e0..7aa1748 100644 --- a/Modules/CheckFunctionExists.cmake +++ b/Modules/CheckFunctionExists.cmake @@ -27,7 +27,6 @@ # (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_FUNCTION_EXISTS FUNCTION VARIABLE) @@ -36,10 +35,8 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") message(STATUS "Looking for ${FUNCTION}") 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_FUNCTION_EXISTS_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") + LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) else() set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) endif() @@ -53,8 +50,8 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) ${CMAKE_BINARY_DIR} ${CMAKE_ROOT}/Modules/CheckFunctionExists.c COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + ${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}" "${CHECK_FUNCTION_EXISTS_ADD_INCLUDES}" OUTPUT_VARIABLE OUTPUT) if(${VARIABLE}) |