diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-01-12 11:13:19 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-01-15 19:36:22 (GMT) |
commit | 522bdac14963acf7c147f5518ea51382b042bf96 (patch) | |
tree | a52af802f40343b92da941080225ad0c2ea21e4d /Tests/ExportImport/Import | |
parent | 4ee872cb99f49ac5a95768da454f3313ba87182f (diff) | |
download | CMake-522bdac14963acf7c147f5518ea51382b042bf96.zip CMake-522bdac14963acf7c147f5518ea51382b042bf96.tar.gz CMake-522bdac14963acf7c147f5518ea51382b042bf96.tar.bz2 |
Export the INTERFACE_PIC property.
Diffstat (limited to 'Tests/ExportImport/Import')
-rw-r--r-- | Tests/ExportImport/Import/A/CMakeLists.txt | 18 | ||||
-rw-r--r-- | Tests/ExportImport/Import/A/deps_shared_iface.cpp | 6 |
2 files changed, 24 insertions, 0 deletions
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 72d11b6..4812e7e 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -167,6 +167,24 @@ target_link_libraries(deps_shared_iface testSharedLibDepends) target_include_directories(deps_shared_iface PRIVATE testSharedLibDepends) target_compile_definitions(deps_shared_iface PRIVATE testSharedLibDepends) +if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag(-fPIE run_pic_test) +else() + if (CMAKE_CXX_COMPILER_ID MATCHES "PGI" + OR CMAKE_CXX_COMPILER_ID MATCHES "PathScale" + OR CMAKE_SYSTEM_NAME MATCHES "IRIX64" + OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") + set(run_pic_test 0) + else() + set(run_pic_test 1) + endif() +endif() + +if (run_pic_test) + target_compile_definitions(deps_shared_iface PRIVATE CHECK_PIC_WORKS) +endif() + #----------------------------------------------------------------------------- # Test that targets imported from the build tree have their dependencies # evaluated correctly. The above already tests the same for the install tree. diff --git a/Tests/ExportImport/Import/A/deps_shared_iface.cpp b/Tests/ExportImport/Import/A/deps_shared_iface.cpp index 14aac0a..43f832a 100644 --- a/Tests/ExportImport/Import/A/deps_shared_iface.cpp +++ b/Tests/ExportImport/Import/A/deps_shared_iface.cpp @@ -2,6 +2,12 @@ #include "testSharedLibDepends.h" +#ifdef CHECK_PIC_WORKS +#if defined(__ELF__) && !defined(__PIC__) && !defined(__PIE__) +#error Expected by INTERFACE_POSITION_INDEPENDENT_CODE property of dependency +#endif +#endif + #ifdef TEST_SUBDIR_LIB #include "subdir.h" #endif |