summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2018-08-15 11:58:26 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-08-15 11:58:39 (GMT)
commita6f7a01f3acb97f9e7fd48705aca33a19564671f (patch)
treeba37f7fa92fd9459398a65bc695ca1b5276f5755 /Tests
parentca2e781703dab42f309bf31189011d69e37b954f (diff)
parent6b17d85873faf0c094c4287e1dd690fcdcbbb2c7 (diff)
downloadCMake-a6f7a01f3acb97f9e7fd48705aca33a19564671f.zip
CMake-a6f7a01f3acb97f9e7fd48705aca33a19564671f.tar.gz
CMake-a6f7a01f3acb97f9e7fd48705aca33a19564671f.tar.bz2
Merge topic 'better_static_link_flags_docs'
6b17d85873 Help: Document when LINK_FLAGS and STATIC_LIBRARY_FLAGS are used 9561d42f95 target_link_options: Add test to verify static library behavior Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Robert Maynard <robert.maynard@kitware.com> Merge-request: !2274
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-static-check.cmake7
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-static-result.txt1
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake7
-rw-r--r--Tests/RunCMake/target_link_options/RunCMakeTest.cmake1
4 files changed, 16 insertions, 0 deletions
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-check.cmake
new file mode 100644
index 0000000..b68e451
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-check.cmake
@@ -0,0 +1,7 @@
+
+if (actual_stdout MATCHES "BADFLAG_RELEASE")
+ set (RunCMake_TEST_FAILED "Found 'BADFLAG_RELEASE' which was not expected.")
+endif()
+if (actual_stdout MATCHES "SHELL:")
+ string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.")
+endif()
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake
index f17195d..84cf129 100644
--- a/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake
@@ -22,6 +22,13 @@ add_executable(LinkOptions_consumer LinkOptionsExe.c)
target_link_libraries(LinkOptions_consumer PRIVATE LinkOptions_producer)
+# static library with generator expression
+add_library(LinkOptions_static STATIC LinkOptionsLib.c)
+target_link_options(LinkOptions_static PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>
+ "SHELL:" # produces no options
+ )
+
+
# shared library with generator expression
add_library(LinkOptions_shared SHARED LinkOptionsLib.c)
target_link_options(LinkOptions_shared PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>
diff --git a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake
index 121a0ce..39f580f 100644
--- a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake
@@ -21,6 +21,7 @@ if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
run_cmake_target(LINK_OPTIONS basic LinkOptions)
run_cmake_target(LINK_OPTIONS interface LinkOptions_consumer)
+ run_cmake_target(LINK_OPTIONS static LinkOptions_static --config Release)
run_cmake_target(LINK_OPTIONS shared LinkOptions_shared --config Release)
run_cmake_target(LINK_OPTIONS mod LinkOptions_mod --config Release)
run_cmake_target(LINK_OPTIONS exe LinkOptions_exe --config Release)