Tests: Test per-CC behavior of CMP0116

This commit is contained in:
Kyle Edwards
2021-02-22 15:27:49 -05:00
parent 3a95503512
commit cf34011ce7
3 changed files with 38 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
^CMake Warning \(dev\) at CMP0116-Mixed\.cmake:1 \(add_custom_command\):
Policy CMP0116 is not set: Ninja generators transform DEPFILEs from
add_custom_command\(\)\. Run "cmake --help-policy CMP0116" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
Call Stack \(most recent call first\):
CMakeLists\.txt:[0-9]+ \(include\)
This warning is for project developers\. Use -Wno-dev to suppress it\.(
CMake Warning \(dev\) at CMP0116-Mixed\.cmake:1 \(add_custom_command\):
Policy CMP0116 is not set: Ninja generators transform DEPFILEs from
add_custom_command\(\)\. Run "cmake --help-policy CMP0116" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
Call Stack \(most recent call first\):
CMakeLists\.txt:[0-9]+ \(include\)
This warning is for project developers\. Use -Wno-dev to suppress it\.)*$

View File

@@ -0,0 +1,18 @@
add_custom_command(
OUTPUT warn.txt
COMMAND ${CMAKE_COMMAND} -E touch warn.txt
DEPFILE warn.d
)
cmake_policy(SET CMP0116 OLD)
add_custom_command(
OUTPUT old.txt
COMMAND ${CMAKE_COMMAND} -E touch old.txt
DEPFILE old.d
)
cmake_policy(SET CMP0116 NEW)
add_custom_command(
OUTPUT new.txt
COMMAND ${CMAKE_COMMAND} -E touch new.txt
DEPFILE new.d
)
add_custom_target(cc ALL DEPENDS warn.txt old.txt new.txt)

View File

@@ -47,3 +47,6 @@ run_cmp0116(NEW OFF)
run_cmp0116(WARN ON)
run_cmp0116(OLD ON)
run_cmp0116(NEW ON)
set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_WARNING_CMP0116:BOOL=TRUE)
run_cmake(CMP0116-Mixed)