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 /Tests/ExportImport | |
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 'Tests/ExportImport')
-rw-r--r-- | Tests/ExportImport/Import/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/ExportImport/Import/try_compile/CMakeLists.txt | 21 |
2 files changed, 23 insertions, 0 deletions
diff --git a/Tests/ExportImport/Import/CMakeLists.txt b/Tests/ExportImport/Import/CMakeLists.txt index 3fc78a2..9c2d597 100644 --- a/Tests/ExportImport/Import/CMakeLists.txt +++ b/Tests/ExportImport/Import/CMakeLists.txt @@ -17,3 +17,5 @@ add_executable(imp_testTransExe1 imp_testTransExe1.c) target_link_libraries(imp_testTransExe1 imp_lib1) add_executable(imp_testTransExe1b imp_testTransExe1.c) target_link_libraries(imp_testTransExe1b imp_lib1b) + +add_subdirectory(try_compile) diff --git a/Tests/ExportImport/Import/try_compile/CMakeLists.txt b/Tests/ExportImport/Import/try_compile/CMakeLists.txt new file mode 100644 index 0000000..5600dff --- /dev/null +++ b/Tests/ExportImport/Import/try_compile/CMakeLists.txt @@ -0,0 +1,21 @@ + +cmake_minimum_required(VERSION 2.8) + +find_package(testLibRequired 2.5 REQUIRED) + +include(CheckCXXSourceCompiles) + +set(CMAKE_REQUIRED_LIBRARIES Req::testSharedLibRequired) +check_cxx_source_compiles( + " +#include \"testSharedLibRequired.h\" +int main(int argc, char **argv) +{ + TestSharedLibRequired req; + return req.foo(); +} +" SHARED_LIB_REQUIRED) + +if(NOT SHARED_LIB_REQUIRED) + message(SEND_ERROR "try_compile with IMPORTED targets failed!\n\n${OUTPUT}") +endif() |