浏览代码

Genex: Add a test for the LINK_ONLY expression.

Commit 239b0c6b (Don't add invalid content to static lib
INTERFACE_LINK_LIBRARIES., 2013-10-20) extended a test which
excercised the logic of the LINK_ONLY generator expression.

Commit ef10b87c (CMP0022: Plain target_link_libraries must populate
link interface, 2013-11-02) removed the instance of LINK_ONLY which
was excercised by that test.

Add a new test which excercises the other instance of LINK_ONLY by
setting the CMP0022 policy to NEW and consuming the contents of the
INTERFACE_LINK_LIBRARIES target property.
Stephen Kelly 12 年之前
父节点
当前提交
53b10fdad7

+ 1 - 0
Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt

@@ -0,0 +1 @@
+^$

+ 14 - 0
Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW.cmake

@@ -0,0 +1,14 @@
+
+project(CMP0022-NOWARN-static-NEW)
+
+cmake_policy(SET CMP0022 NEW)
+
+add_library(foo STATIC empty_vs6_1.cpp)
+add_library(bar STATIC empty_vs6_2.cpp)
+add_library(bat STATIC empty_vs6_3.cpp)
+target_link_libraries(foo bar)
+# The last element here needs to contain a space so that it is a single
+# element which is not a valid target name. As bar is a STATIC library,
+# this tests that the LINK_ONLY generator expression is not used for
+# that element, creating an error.
+target_link_libraries(bar LINK_PRIVATE bat "-lz -lm")

+ 1 - 5
Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake

@@ -5,8 +5,4 @@ add_library(foo STATIC empty_vs6_1.cpp)
 add_library(bar STATIC empty_vs6_2.cpp)
 add_library(bat STATIC empty_vs6_3.cpp)
 target_link_libraries(foo bar)
-# The last element here needs to contain a space so that it is a single
-# element which is not a valid target name. As bar is a STATIC library,
-# this tests that the LINK_ONLY generator expression is not used for
-# that element, creating an error.
-target_link_libraries(bar bat "-lz -lm")
+target_link_libraries(bar bat)

+ 1 - 0
Tests/RunCMake/CMP0022/RunCMakeTest.cmake

@@ -7,6 +7,7 @@ run_cmake(CMP0022-WARN-empty-old)
 run_cmake(CMP0022-NOWARN-exe)
 run_cmake(CMP0022-NOWARN-shared)
 run_cmake(CMP0022-NOWARN-static)
+run_cmake(CMP0022-NOWARN-static-NEW)
 run_cmake(CMP0022-NOWARN-static-link_libraries)
 run_cmake(CMP0022-export)
 run_cmake(CMP0022-export-exe)