summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorNils Gladitz <nilsgladitz@gmail.com>2013-11-16 10:07:24 (GMT)
committerBrad King <brad.king@kitware.com>2013-11-19 14:44:22 (GMT)
commit3900fcf4a8eee24141e2d562c1b6b796b456c838 (patch)
tree5f0ffc818922b71848c91bb3fa29bcde63cacc93 /Tests
parent958367e10cee44d2dbce72f9393168746099ebd1 (diff)
downloadCMake-3900fcf4a8eee24141e2d562c1b6b796b456c838.zip
CMake-3900fcf4a8eee24141e2d562c1b6b796b456c838.tar.gz
CMake-3900fcf4a8eee24141e2d562c1b6b796b456c838.tar.bz2
CMP0037: Extend policy to reserved names and custom targets
Teach add_custom_target to check the policy too. Extend the policy to disallow reserved target names that we use for builtin targets like "all". Extend the RunCMake.CMP0037 test to cover these cases.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt36
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake1
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-result.txt1
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt33
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake6
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt36
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake1
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-result.txt1
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake6
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake1
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt37
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake1
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt36
-rw-r--r--Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake1
-rw-r--r--Tests/RunCMake/CMP0037/RunCMakeTest.cmake3
16 files changed, 161 insertions, 40 deletions
diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt
index aadc7d7..9d2c35b 100644
--- a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt
+++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt
@@ -1,19 +1,35 @@
CMake Error at CMP0037-NEW-colon.cmake:4 \(add_library\):
- Policy CMP0037 is not set: Target names should match a validity pattern.
- Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
+ Policy CMP0037 is not set: Target names should not be reserved and should
+ match a validity pattern. Run "cmake --help-policy CMP0037" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
- The target name "lib:colon" is not valid for certain CMake features, such
- as generator expressions, and may result in undefined behavior.
+ The target name "lib:colon" is reserved or not valid for certain CMake
+ features, such as generator expressions, and may result in undefined
+ behavior.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
CMake Error at CMP0037-NEW-colon.cmake:5 \(add_executable\):
- Policy CMP0037 is not set: Target names should match a validity pattern.
- Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
+ Policy CMP0037 is not set: Target names should not be reserved and should
+ match a validity pattern. Run "cmake --help-policy CMP0037" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
- The target name "exe:colon" is not valid for certain CMake features, such
- as generator expressions, and may result in undefined behavior.
+ The target name "exe:colon" is reserved or not valid for certain CMake
+ features, such as generator expressions, and may result in undefined
+ behavior.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at CMP0037-NEW-colon.cmake:6 \(add_custom_target\):
+ Policy CMP0037 is not set: Target names should not be reserved and should
+ match a validity pattern. Run "cmake --help-policy CMP0037" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+
+ The target name "custom:colon" is reserved or not valid for certain CMake
+ features, such as generator expressions, and may result in undefined
+ behavior.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake
index 5c564f3..f4c070d 100644
--- a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake
+++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake
@@ -3,3 +3,4 @@ cmake_policy(SET CMP0037 NEW)
add_library("lib:colon" empty.cpp)
add_executable("exe:colon" empty.cpp)
+add_custom_target("custom:colon")
diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-result.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt
new file mode 100644
index 0000000..13835af
--- /dev/null
+++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt
@@ -0,0 +1,33 @@
+CMake Error at CMP0037-NEW-reserved.cmake:4 \(add_library\):
+ Policy CMP0037 is not set: Target names should not be reserved and should
+ match a validity pattern. Run "cmake --help-policy CMP0037" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+
+ The target name "all" is reserved or not valid for certain CMake features,
+ such as generator expressions, and may result in undefined behavior.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at CMP0037-NEW-reserved.cmake:5 \(add_executable\):
+ Policy CMP0037 is not set: Target names should not be reserved and should
+ match a validity pattern. Run "cmake --help-policy CMP0037" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+
+ The target name "clean" is reserved or not valid for certain CMake
+ features, such as generator expressions, and may result in undefined
+ behavior.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at CMP0037-NEW-reserved.cmake:6 \(add_custom_target\):
+ Policy CMP0037 is not set: Target names should not be reserved and should
+ match a validity pattern. Run "cmake --help-policy CMP0037" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+
+ The target name "help" is reserved or not valid for certain CMake features,
+ such as generator expressions, and may result in undefined behavior.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake
new file mode 100644
index 0000000..e9f6404
--- /dev/null
+++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake
@@ -0,0 +1,6 @@
+
+cmake_policy(SET CMP0037 NEW)
+
+add_library(all empty.cpp)
+add_executable(clean empty.cpp)
+add_custom_target(help)
diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt
index 169db86..2525bcd 100644
--- a/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt
+++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt
@@ -1,19 +1,35 @@
CMake Error at CMP0037-NEW-space.cmake:4 \(add_library\):
- Policy CMP0037 is not set: Target names should match a validity pattern.
- Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
+ Policy CMP0037 is not set: Target names should not be reserved and should
+ match a validity pattern. Run "cmake --help-policy CMP0037" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
- The target name "lib with spaces" is not valid for certain CMake features,
- such as generator expressions, and may result in undefined behavior.
+ The target name "lib with spaces" is reserved or not valid for certain
+ CMake features, such as generator expressions, and may result in undefined
+ behavior.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
CMake Error at CMP0037-NEW-space.cmake:5 \(add_executable\):
- Policy CMP0037 is not set: Target names should match a validity pattern.
- Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
+ Policy CMP0037 is not set: Target names should not be reserved and should
+ match a validity pattern. Run "cmake --help-policy CMP0037" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
- The target name "exe with spaces" is not valid for certain CMake features,
- such as generator expressions, and may result in undefined behavior.
+ The target name "exe with spaces" is reserved or not valid for certain
+ CMake features, such as generator expressions, and may result in undefined
+ behavior.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at CMP0037-NEW-space.cmake:6 \(add_custom_target\):
+ Policy CMP0037 is not set: Target names should not be reserved and should
+ match a validity pattern. Run "cmake --help-policy CMP0037" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+
+ The target name "custom with spaces" is reserved or not valid for certain
+ CMake features, such as generator expressions, and may result in undefined
+ behavior.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake b/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake
index 9e2faaa..9227986 100644
--- a/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake
+++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake
@@ -3,3 +3,4 @@ cmake_policy(SET CMP0037 NEW)
add_library("lib with spaces" empty.cpp)
add_executable("exe with spaces" empty.cpp)
+add_custom_target("custom with spaces")
diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-result.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake
new file mode 100644
index 0000000..870a286
--- /dev/null
+++ b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake
@@ -0,0 +1,6 @@
+
+cmake_policy(SET CMP0037 OLD)
+
+add_library(all empty.cpp)
+add_executable(clean empty.cpp)
+add_custom_target(help)
diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake b/Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake
index af98f12..46193a1 100644
--- a/Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake
+++ b/Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake
@@ -3,3 +3,4 @@ cmake_policy(SET CMP0037 OLD)
add_library("lib with spaces" empty.cpp)
add_executable("exe with spaces" empty.cpp)
+add_custom_target("custom with spaces")
diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt
index c9366fa..d3b0e17 100644
--- a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt
+++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt
@@ -1,21 +1,38 @@
CMake Warning \(dev\) at CMP0037-WARN-colon.cmake:2 \(add_library\):
- Policy CMP0037 is not set: Target names should match a validity pattern.
- Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
+ Policy CMP0037 is not set: Target names should not be reserved and should
+ match a validity pattern. Run "cmake --help-policy CMP0037" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
- The target name "lib:colon" is not valid for certain CMake features, such
- as generator expressions, and may result in undefined behavior.
+ The target name "lib:colon" is reserved or not valid for certain CMake
+ features, such as generator expressions, and may result in undefined
+ behavior.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
+
CMake Warning \(dev\) at CMP0037-WARN-colon.cmake:3 \(add_executable\):
- Policy CMP0037 is not set: Target names should match a validity pattern.
- Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
+ Policy CMP0037 is not set: Target names should not be reserved and should
+ match a validity pattern. Run "cmake --help-policy CMP0037" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
- The target name "exe:colon" is not valid for certain CMake features, such
- as generator expressions, and may result in undefined behavior.
+ The target name "exe:colon" is reserved or not valid for certain CMake
+ features, such as generator expressions, and may result in undefined
+ behavior.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
++
+CMake Warning \(dev\) at CMP0037-WARN-colon.cmake:4 \(add_custom_target\):
+ Policy CMP0037 is not set: Target names should not be reserved and should
+ match a validity pattern. Run "cmake --help-policy CMP0037" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+
+ The target name "custom:colon" is reserved or not valid for certain CMake
+ features, such as generator expressions, and may result in undefined
+ behavior.
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/CMP0037/CMP0037-WARN-colon.cmake b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake
index 17c815e..445e3b2 100644
--- a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake
+++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake
@@ -1,3 +1,4 @@
add_library("lib:colon" empty.cpp)
add_executable("exe:colon" empty.cpp)
+add_custom_target("custom:colon")
diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt
index b29aad5..e39477a 100644
--- a/Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt
+++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt
@@ -1,21 +1,37 @@
CMake Warning \(dev\) at CMP0037-WARN-space.cmake:2 \(add_library\):
- Policy CMP0037 is not set: Target names should match a validity pattern.
- Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
+ Policy CMP0037 is not set: Target names should not be reserved and should
+ match a validity pattern. Run "cmake --help-policy CMP0037" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
- The target name "lib with spaces" is not valid for certain CMake features,
- such as generator expressions, and may result in undefined behavior.
+ The target name "lib with spaces" is reserved or not valid for certain
+ CMake features, such as generator expressions, and may result in undefined
+ behavior.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
+
CMake Warning \(dev\) at CMP0037-WARN-space.cmake:3 \(add_executable\):
- Policy CMP0037 is not set: Target names should match a validity pattern.
- Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy
- command to set the policy and suppress this warning.
+ Policy CMP0037 is not set: Target names should not be reserved and should
+ match a validity pattern. Run "cmake --help-policy CMP0037" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
- The target name "exe with spaces" is not valid for certain CMake features,
- such as generator expressions, and may result in undefined behavior.
+ The target name "exe with spaces" is reserved or not valid for certain
+ CMake features, such as generator expressions, and may result in undefined
+ behavior.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
++
+CMake Warning \(dev\) at CMP0037-WARN-space.cmake:4 \(add_custom_target\):
+ Policy CMP0037 is not set: Target names should not be reserved and should
+ match a validity pattern. Run "cmake --help-policy CMP0037" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+
+ The target name "custom with spaces" is reserved or not valid for certain
+ CMake features, such as generator expressions, and may result in undefined
+ behavior.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake b/Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake
index 4a10828..e50a64d 100644
--- a/Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake
+++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake
@@ -1,3 +1,4 @@
add_library("lib with spaces" empty.cpp)
add_executable("exe with spaces" empty.cpp)
+add_custom_target("custom with spaces")
diff --git a/Tests/RunCMake/CMP0037/RunCMakeTest.cmake b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake
index fbb1788..b7d8d7b 100644
--- a/Tests/RunCMake/CMP0037/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake
@@ -8,3 +8,6 @@ run_cmake(CMP0037-NEW-colon)
if(NOT (WIN32 AND "${RunCMake_GENERATOR}" MATCHES "Make"))
run_cmake(CMP0037-WARN-colon)
endif()
+
+run_cmake(CMP0037-OLD-reserved)
+run_cmake(CMP0037-NEW-reserved)