diff options
author | Alex Neundorf <neundorf@kde.org> | 2012-02-16 22:35:43 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-02-21 20:38:15 (GMT) |
commit | 35c48e12706f9426eda43b3b077925a2fab0df44 (patch) | |
tree | dfffa85521bf233345e49ed6dae2d28715c2ee77 /Modules/CheckPrototypeDefinition.cmake | |
parent | 61cb4ea72e608370b581bae9d9810ca6ae8f84d0 (diff) | |
download | CMake-35c48e12706f9426eda43b3b077925a2fab0df44.zip CMake-35c48e12706f9426eda43b3b077925a2fab0df44.tar.gz CMake-35c48e12706f9426eda43b3b077925a2fab0df44.tar.bz2 |
Check*.cmake: Expand imported targets in CMAKE_REQUIRED_LIBRARIES
Add the function cmake_expand_imported_targets() to expand imported
targets in a list of libraries into their on-disk file names for a
particular configuration. Adapt the implementation from KDE's
HANDLE_IMPORTED_TARGETS_IN_CMAKE_REQUIRED_LIBRARIES which has been in
use for over 2 years. Call the function from all the Check*.cmake
macros to handle imported targets named in CMAKE_REQUIRED_LIBRARIES.
Alex
Diffstat (limited to 'Modules/CheckPrototypeDefinition.cmake')
-rw-r--r-- | Modules/CheckPrototypeDefinition.cmake | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake index 244b9b5..63d4242 100644 --- a/Modules/CheckPrototypeDefinition.cmake +++ b/Modules/CheckPrototypeDefinition.cmake @@ -34,8 +34,11 @@ # License text for the above reference.) # +include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + get_filename_component(__check_proto_def_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) + function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIABLE) if ("${_VARIABLE}" MATCHES "^${_VARIABLE}$") @@ -43,8 +46,10 @@ function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB set(CHECK_PROTOTYPE_DEFINITION_FLAGS ${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_PROTOTYPE_DEFINITION_LIBS - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") else(CMAKE_REQUIRED_LIBRARIES) set(CHECK_PROTOTYPE_DEFINITION_LIBS) endif(CMAKE_REQUIRED_LIBRARIES) |