summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-11-05 18:15:53 (GMT)
committerStephen Kelly <steveire@gmail.com>2013-11-07 10:06:40 (GMT)
commit596b2a8c0820bed8195e2377927a18cf2d76727c (patch)
tree093b7a88d4d3b32dffce49dce5d57d27ceeaa1aa /Tests/RunCMake
parent301bb5cdda081f0bef0702e41ae4b47102b235df (diff)
downloadCMake-596b2a8c0820bed8195e2377927a18cf2d76727c.zip
CMake-596b2a8c0820bed8195e2377927a18cf2d76727c.tar.gz
CMake-596b2a8c0820bed8195e2377927a18cf2d76727c.tar.bz2
Disallow linking to utility targets (#13902).
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CMP0039/CMP0039-NEW-result.txt1
-rw-r--r--Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt9
-rw-r--r--Tests/RunCMake/CMP0039/CMP0039-NEW.cmake7
-rw-r--r--Tests/RunCMake/CMP0039/CMP0039-OLD-result.txt1
-rw-r--r--Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0039/CMP0039-OLD.cmake7
-rw-r--r--Tests/RunCMake/CMP0039/CMP0039-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0039/CMP0039-WARN-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0039/CMP0039-WARN.cmake5
-rw-r--r--Tests/RunCMake/CMP0039/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0039/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
12 files changed, 51 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMP0039/CMP0039-NEW-result.txt b/Tests/RunCMake/CMP0039/CMP0039-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0039/CMP0039-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt b/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt
new file mode 100644
index 0000000..1496c05
--- /dev/null
+++ b/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt
@@ -0,0 +1,9 @@
+CMake Error at CMP0039-NEW.cmake:7 \(target_link_libraries\):
+ Policy CMP0039 is not set: Utility targets may not have link dependencies
+ Run "cmake --help-policy CMP0039" for policy details. Use the cmake_policy
+ command to set the policy and suppress this warning.
+
+ Utility target "utility" must not be used as the target of a
+ target_link_libraries call.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0039/CMP0039-NEW.cmake b/Tests/RunCMake/CMP0039/CMP0039-NEW.cmake
new file mode 100644
index 0000000..2032d64
--- /dev/null
+++ b/Tests/RunCMake/CMP0039/CMP0039-NEW.cmake
@@ -0,0 +1,7 @@
+
+cmake_policy(SET CMP0039 NEW)
+
+add_custom_target(utility
+ COMMAND ${CMAKE_COMMAND} -E echo test
+)
+target_link_libraries(utility m)
diff --git a/Tests/RunCMake/CMP0039/CMP0039-OLD-result.txt b/Tests/RunCMake/CMP0039/CMP0039-OLD-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0039/CMP0039-OLD-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt b/Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/CMP0039/CMP0039-OLD.cmake b/Tests/RunCMake/CMP0039/CMP0039-OLD.cmake
new file mode 100644
index 0000000..9a513f4
--- /dev/null
+++ b/Tests/RunCMake/CMP0039/CMP0039-OLD.cmake
@@ -0,0 +1,7 @@
+
+cmake_policy(SET CMP0039 OLD)
+
+add_custom_target(utility
+ COMMAND ${CMAKE_COMMAND} -E echo test
+)
+target_link_libraries(utility m)
diff --git a/Tests/RunCMake/CMP0039/CMP0039-WARN-result.txt b/Tests/RunCMake/CMP0039/CMP0039-WARN-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0039/CMP0039-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0039/CMP0039-WARN-stderr.txt b/Tests/RunCMake/CMP0039/CMP0039-WARN-stderr.txt
new file mode 100644
index 0000000..9387f8c
--- /dev/null
+++ b/Tests/RunCMake/CMP0039/CMP0039-WARN-stderr.txt
@@ -0,0 +1,10 @@
+CMake Warning \(dev\) at CMP0039-WARN.cmake:5 \(target_link_libraries\):
+ Policy CMP0039 is not set: Utility targets may not have link dependencies
+ Run "cmake --help-policy CMP0039" for policy details. Use the cmake_policy
+ command to set the policy and suppress this warning.
+
+ Utility target "utility" should not be used as the target of a
+ target_link_libraries call.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0039/CMP0039-WARN.cmake b/Tests/RunCMake/CMP0039/CMP0039-WARN.cmake
new file mode 100644
index 0000000..6249993
--- /dev/null
+++ b/Tests/RunCMake/CMP0039/CMP0039-WARN.cmake
@@ -0,0 +1,5 @@
+
+add_custom_target(utility
+ COMMAND ${CMAKE_COMMAND} -E echo test
+)
+target_link_libraries(utility m)
diff --git a/Tests/RunCMake/CMP0039/CMakeLists.txt b/Tests/RunCMake/CMP0039/CMakeLists.txt
new file mode 100644
index 0000000..2f10cb0
--- /dev/null
+++ b/Tests/RunCMake/CMP0039/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.12)
+project(${RunCMake_TEST} CXX)
+include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
diff --git a/Tests/RunCMake/CMP0039/RunCMakeTest.cmake b/Tests/RunCMake/CMP0039/RunCMakeTest.cmake
new file mode 100644
index 0000000..58e8ea9
--- /dev/null
+++ b/Tests/RunCMake/CMP0039/RunCMakeTest.cmake
@@ -0,0 +1,5 @@
+include(RunCMake)
+
+run_cmake(CMP0039-WARN)
+run_cmake(CMP0039-NEW)
+run_cmake(CMP0039-OLD)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 5c4ac7d..6e72e70 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -60,6 +60,7 @@ if (NOT "${CMAKE_TEST_GENERATOR}" MATCHES "(MSYS|MinGW|NMake|Borland) Makefiles"
add_RunCMake_test(CMP0037)
endif()
add_RunCMake_test(CMP0038)
+add_RunCMake_test(CMP0039)
add_RunCMake_test(CTest)
if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles")
add_RunCMake_test(CompilerChange)