summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-03-17 13:13:40 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-03-17 13:13:47 (GMT)
commite56afbca89c7acd826cddc676a68fbbe2b75398e (patch)
treedd0d68c1b7555fc0d7b65907265b4089123f5ffb /Tests
parent7f36e0ff6ec624668b1353ad706c0663637cbbb7 (diff)
parentadd64399c54859d26f9954fb06d616dbd00bffe7 (diff)
downloadCMake-e56afbca89c7acd826cddc676a68fbbe2b75398e.zip
CMake-e56afbca89c7acd826cddc676a68fbbe2b75398e.tar.gz
CMake-e56afbca89c7acd826cddc676a68fbbe2b75398e.tar.bz2
Merge topic 'tll-genex-concat'
add64399c5 target_link_libraries: Restore LINK_ONLY for multiple static lib dependencies Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !7078
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt16
-rw-r--r--Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib1.cpp6
-rw-r--r--Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib2.cpp6
3 files changed, 28 insertions, 0 deletions
diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt
index ca6309b..ebade02 100644
--- a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt
@@ -33,6 +33,22 @@ add_library(staticlib2 STATIC staticlib2.cpp)
generate_export_header(staticlib2)
target_link_libraries(staticlib1 LINK_PUBLIC staticlib2)
+# Test adding LINK_ONLY to each of multiple specified libraries.
+add_library(staticlib2iface1 INTERFACE)
+add_library(staticlib2iface2 INTERFACE)
+target_compile_definitions(staticlib2iface1 INTERFACE STATICLIB2_IFACE_1)
+target_compile_definitions(staticlib2iface2 INTERFACE STATICLIB2_IFACE_2)
+target_link_libraries(staticlib2 PRIVATE staticlib2iface1 staticlib2iface2)
+
+# Test adding unquoted genex with ';' to LINK_LIBRARIES and INTERFACE_LINK_LIBRARIES.
+target_link_libraries(staticlib2
+ PUBLIC $<0:imp::missing1;imp::missing2>
+ PRIVATE $<0:imp::missing3;imp::missing4>
+ INTERFACE $<0:imp::missing5;imp::missing6>
+ )
+assert_property(staticlib2 INTERFACE_LINK_LIBRARIES "$<LINK_ONLY:staticlib2iface1>;$<LINK_ONLY:staticlib2iface2>;$<0:imp::missing1;imp::missing2>;$<LINK_ONLY:$<0:imp::missing3;imp::missing4>>;$<0:imp::missing5;imp::missing6>")
+assert_property(staticlib2 LINK_LIBRARIES "staticlib2iface1;staticlib2iface2;$<0:imp::missing1;imp::missing2>;$<0:imp::missing3;imp::missing4>")
+
# Try adding a private link item to be propagated out of a static lib.
set(private_link "")
if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang OR CMAKE_CXX_COMPILER_ID MATCHES LCC)
diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib1.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib1.cpp
index d6b3986..d7f3e7c 100644
--- a/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib1.cpp
+++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib1.cpp
@@ -1,3 +1,9 @@
+#ifdef STATICLIB2_IFACE_1
+# error "STATICLIB2_IFACE_1 incorrectly defined"
+#endif
+#ifdef STATICLIB2_IFACE_2
+# error "STATICLIB2_IFACE_2 incorrectly defined"
+#endif
int staticlib1()
{
diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib2.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib2.cpp
index bd1a901..caa4143 100644
--- a/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib2.cpp
+++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib2.cpp
@@ -1,3 +1,9 @@
+#ifndef STATICLIB2_IFACE_1
+# error "STATICLIB2_IFACE_1 incorrectly not defined"
+#endif
+#ifndef STATICLIB2_IFACE_2
+# error "STATICLIB2_IFACE_2 incorrectly not defined"
+#endif
int staticlib2()
{