diff options
Diffstat (limited to 'Tests/CMakeCommands')
-rw-r--r-- | Tests/CMakeCommands/target_link_libraries/CMakeLists.txt | 16 | ||||
-rw-r--r-- | Tests/CMakeCommands/target_link_libraries/compile_only.cpp | 8 |
2 files changed, 24 insertions, 0 deletions
diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt index b2365ca..8231a5c 100644 --- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt @@ -155,3 +155,19 @@ target_link_libraries(TopDir SubDirC) add_library(TopDirImported IMPORTED INTERFACE) target_compile_definitions(TopDirImported INTERFACE DEF_TopDirImported) cmake_policy(POP) + +#---------------------------------------------------------------------------- +# Test $<COMPILE_ONLY:> genex. +cmake_policy(SET CMP0099 NEW) +add_library(dont_link_too SHARED compile_only.cpp) +target_compile_definitions(dont_link_too PUBLIC USE_EXAMPLE) +target_link_options(dont_link_too INTERFACE invalid_link_option) +target_link_libraries(dont_link_too INTERFACE invalid_link_library) + +add_library(uses_compile_only_genex SHARED compile_only.cpp) +target_link_libraries(uses_compile_only_genex PUBLIC $<COMPILE_ONLY:dont_link_too>) + +add_library(uses_compile_only_genex_static STATIC compile_only.cpp) +target_link_libraries(uses_compile_only_genex_static PRIVATE $<COMPILE_ONLY:dont_link_too>) +add_executable(uses_via_static_linking main.cxx) +target_link_libraries(uses_via_static_linking PRIVATE uses_compile_only_genex_static) diff --git a/Tests/CMakeCommands/target_link_libraries/compile_only.cpp b/Tests/CMakeCommands/target_link_libraries/compile_only.cpp new file mode 100644 index 0000000..7519bd0 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/compile_only.cpp @@ -0,0 +1,8 @@ + +#ifndef USE_EXAMPLE +# error "Missing propagated define" +#endif + +// Solaris needs non-empty content so ensure +// we have at least one symbol +int Solaris_requires_a_symbol_here = 0; |