summaryrefslogtreecommitdiff
path: root/Tests/ExportImport/Import
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2012-02-16 23:35:43 +0100
committerBrad King <brad.king@kitware.com>2012-02-21 15:38:15 -0500
commit35c48e12706f9426eda43b3b077925a2fab0df44 (patch)
treedfffa85521bf233345e49ed6dae2d28715c2ee77 /Tests/ExportImport/Import
parent61cb4ea72e608370b581bae9d9810ca6ae8f84d0 (diff)
downloadcmake-35c48e12706f9426eda43b3b077925a2fab0df44.tar.gz
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 'Tests/ExportImport/Import')
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt11
1 files changed, 11 insertions, 0 deletions
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index e65e362ecb..a21e1b0f8e 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -137,3 +137,14 @@ add_library(imp_lib1 STATIC imp_lib1.c)
target_link_libraries(imp_lib1 exp_testLib2)
add_library(imp_lib1b STATIC imp_lib1.c)
target_link_libraries(imp_lib1b bld_testLib2)
+
+#-----------------------------------------------------------------------------
+# Test that handling imported targets, including transitive dependencies,
+# works in CheckFunctionExists (...and hopefully all other try_compile() checks
+include(CheckFunctionExists)
+unset(HAVE_TESTLIB1_FUNCTION CACHE)
+set(CMAKE_REQUIRED_LIBRARIES exp_testLib2)
+check_function_exists(testLib1 HAVE_TESTLIB1_FUNCTION)
+if (NOT HAVE_TESTLIB1_FUNCTION)
+ message(SEND_ERROR "Using imported target testLib2 in check_function_exists() failed !")
+endif()