Просмотр исходного кода

Tests: Add RunCMake.CMP0037 case for WARN on reserved targets

Brad King 8 лет назад
Родитель
Сommit
a2611d816b

+ 36 - 0
Tests/RunCMake/CMP0037/CMP0037-WARN-reserved-stderr.txt

@@ -0,0 +1,36 @@
+CMake Warning \(dev\) at CMP0037-WARN-reserved.cmake:2 \(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\)
+This warning is for project developers.  Use -Wno-dev to suppress it.
++
+CMake Warning \(dev\) at CMP0037-WARN-reserved.cmake:3 \(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\)
+This warning is for project developers.  Use -Wno-dev to suppress it.
++
+CMake Warning \(dev\) at CMP0037-WARN-reserved.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 "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\)
+This warning is for project developers.  Use -Wno-dev to suppress it.

+ 4 - 0
Tests/RunCMake/CMP0037/CMP0037-WARN-reserved.cmake

@@ -0,0 +1,4 @@
+enable_language(CXX)
+add_library(all empty.cpp)
+add_executable(clean empty.cpp)
+add_custom_target(help)

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

@@ -9,5 +9,6 @@ if(NOT (WIN32 AND "${RunCMake_GENERATOR}" MATCHES "Make"))
   run_cmake(CMP0037-WARN-colon)
 endif()
 
+run_cmake(CMP0037-WARN-reserved)
 run_cmake(CMP0037-OLD-reserved)
 run_cmake(CMP0037-NEW-reserved)