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

This commit is contained in:
Brad King 2017-10-26 11:41:29 -04:00
parent 103501c4e0
commit a2611d816b
3 changed files with 41 additions and 0 deletions

View File

@ -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.

View File

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

View File

@ -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)