summaryrefslogtreecommitdiff
path: root/Tests/RunCMake/CMP0038
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-11-05 18:01:09 +0100
committerStephen Kelly <steveire@gmail.com>2013-11-07 11:06:39 +0100
commit301bb5cdda081f0bef0702e41ae4b47102b235df (patch)
tree2ee1e6000296f3db1358d70145daeafc36139e08 /Tests/RunCMake/CMP0038
parent05f5fde0eb83c0e49aab3214f28a098861aa3313 (diff)
downloadcmake-301bb5cdda081f0bef0702e41ae4b47102b235df.tar.gz
Disallow link-to-self (#13947).
Diffstat (limited to 'Tests/RunCMake/CMP0038')
-rw-r--r--Tests/RunCMake/CMP0038/CMP0038-NEW-result.txt1
-rw-r--r--Tests/RunCMake/CMP0038/CMP0038-NEW-stderr.txt4
-rw-r--r--Tests/RunCMake/CMP0038/CMP0038-NEW.cmake4
-rw-r--r--Tests/RunCMake/CMP0038/CMP0038-OLD-result.txt1
-rw-r--r--Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0038/CMP0038-OLD.cmake4
-rw-r--r--Tests/RunCMake/CMP0038/CMP0038-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0038/CMP0038-WARN-stderr.txt9
-rw-r--r--Tests/RunCMake/CMP0038/CMP0038-WARN.cmake3
-rw-r--r--Tests/RunCMake/CMP0038/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0038/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/CMP0038/empty.cpp7
12 files changed, 43 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMP0038/CMP0038-NEW-result.txt b/Tests/RunCMake/CMP0038/CMP0038-NEW-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CMP0038/CMP0038-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0038/CMP0038-NEW-stderr.txt b/Tests/RunCMake/CMP0038/CMP0038-NEW-stderr.txt
new file mode 100644
index 0000000000..3d0a428e18
--- /dev/null
+++ b/Tests/RunCMake/CMP0038/CMP0038-NEW-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at CMP0038-NEW.cmake:3 \(add_library\):
+ Target "self_link" links to itself.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0038/CMP0038-NEW.cmake b/Tests/RunCMake/CMP0038/CMP0038-NEW.cmake
new file mode 100644
index 0000000000..6296b839a2
--- /dev/null
+++ b/Tests/RunCMake/CMP0038/CMP0038-NEW.cmake
@@ -0,0 +1,4 @@
+
+cmake_policy(SET CMP0038 NEW)
+add_library(self_link empty.cpp)
+target_link_libraries(self_link self_link)
diff --git a/Tests/RunCMake/CMP0038/CMP0038-OLD-result.txt b/Tests/RunCMake/CMP0038/CMP0038-OLD-result.txt
new file mode 100644
index 0000000000..573541ac97
--- /dev/null
+++ b/Tests/RunCMake/CMP0038/CMP0038-OLD-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt b/Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt
new file mode 100644
index 0000000000..10f32932ee
--- /dev/null
+++ b/Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/CMP0038/CMP0038-OLD.cmake b/Tests/RunCMake/CMP0038/CMP0038-OLD.cmake
new file mode 100644
index 0000000000..37528218ca
--- /dev/null
+++ b/Tests/RunCMake/CMP0038/CMP0038-OLD.cmake
@@ -0,0 +1,4 @@
+
+cmake_policy(SET CMP0038 OLD)
+add_library(self_link empty.cpp)
+target_link_libraries(self_link self_link)
diff --git a/Tests/RunCMake/CMP0038/CMP0038-WARN-result.txt b/Tests/RunCMake/CMP0038/CMP0038-WARN-result.txt
new file mode 100644
index 0000000000..573541ac97
--- /dev/null
+++ b/Tests/RunCMake/CMP0038/CMP0038-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0038/CMP0038-WARN-stderr.txt b/Tests/RunCMake/CMP0038/CMP0038-WARN-stderr.txt
new file mode 100644
index 0000000000..64631e7ffd
--- /dev/null
+++ b/Tests/RunCMake/CMP0038/CMP0038-WARN-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at CMP0038-WARN.cmake:2 \(add_library\):
+ Policy CMP0038 is not set: Targets may not link directly to themselves.
+ Run "cmake --help-policy CMP0038" for policy details. Use the cmake_policy
+ command to set the policy and suppress this warning.
+
+ Target "self_link" links to itself.
+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/CMP0038/CMP0038-WARN.cmake b/Tests/RunCMake/CMP0038/CMP0038-WARN.cmake
new file mode 100644
index 0000000000..5b92d09518
--- /dev/null
+++ b/Tests/RunCMake/CMP0038/CMP0038-WARN.cmake
@@ -0,0 +1,3 @@
+
+add_library(self_link empty.cpp)
+target_link_libraries(self_link self_link)
diff --git a/Tests/RunCMake/CMP0038/CMakeLists.txt b/Tests/RunCMake/CMP0038/CMakeLists.txt
new file mode 100644
index 0000000000..2f10cb0922
--- /dev/null
+++ b/Tests/RunCMake/CMP0038/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/CMP0038/RunCMakeTest.cmake b/Tests/RunCMake/CMP0038/RunCMakeTest.cmake
new file mode 100644
index 0000000000..fc3500addd
--- /dev/null
+++ b/Tests/RunCMake/CMP0038/RunCMakeTest.cmake
@@ -0,0 +1,5 @@
+include(RunCMake)
+
+run_cmake(CMP0038-WARN)
+run_cmake(CMP0038-NEW)
+run_cmake(CMP0038-OLD)
diff --git a/Tests/RunCMake/CMP0038/empty.cpp b/Tests/RunCMake/CMP0038/empty.cpp
new file mode 100644
index 0000000000..bfbbddeb90
--- /dev/null
+++ b/Tests/RunCMake/CMP0038/empty.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int empty()
+{
+ return 0;
+}