diff options
author | Nils Gladitz <nilsgladitz@gmail.com> | 2013-11-20 08:53:06 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-11-21 14:24:08 (GMT) |
commit | a02f3d2de00a16a68e8948db3c0de507e569f8a3 (patch) | |
tree | 065ce76b2c29a27325a0d36a8869856dbfb6dbe9 /Tests | |
parent | a61025135b1c1ceea9634973b983bd3e47be8bdd (diff) | |
download | CMake-a02f3d2de00a16a68e8948db3c0de507e569f8a3.zip CMake-a02f3d2de00a16a68e8948db3c0de507e569f8a3.tar.gz CMake-a02f3d2de00a16a68e8948db3c0de507e569f8a3.tar.bz2 |
Add policy CMP0040 to disallow custom commands on missing targets
Diffstat (limited to 'Tests')
19 files changed, 74 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-result.txt b/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target.cmake b/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target.cmake new file mode 100644 index 0000000..f9c8afd --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0040 NEW) + +add_library(foobar empty.cpp) + +add_custom_command(TARGET foobar PRE_BUILD + COMMAND "${CMAKE_COMMAND} -E echo hello world" +) diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-result.txt b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt new file mode 100644 index 0000000..03a0217 --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at CMP0040-NEW-missing-target.cmake:3 \(add_custom_command\): + Policy CMP0040 is not set: The target in the TARGET signature of + add_custom_command\(\) must exist. Run "cmake --help-policy CMP0040" for + policy details. Use the cmake_policy command to set the policy and + suppress this warning. ++ + The target name "foobar" is unknown in this context. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target.cmake b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target.cmake new file mode 100644 index 0000000..276863d --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target.cmake @@ -0,0 +1,5 @@ +cmake_policy(SET CMP0040 NEW) + +add_custom_command(TARGET foobar PRE_BUILD + COMMAND "${CMAKE_COMMAND} -E hello world" +) diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-result.txt b/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target.cmake b/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target.cmake new file mode 100644 index 0000000..d7ec50d --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0040 OLD) + +add_library(foobar empty.cpp) + +add_custom_command(TARGET foobar PRE_BUILD + COMMAND "${CMAKE_COMMAND} -E echo hello world" +) diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-result.txt b/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target.cmake b/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target.cmake new file mode 100644 index 0000000..ef7a0f7 --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target.cmake @@ -0,0 +1,5 @@ +cmake_policy(SET CMP0040 OLD) + +add_custom_command(TARGET foobar PRE_BUILD + COMMAND "${CMAKE_COMMAND} -E echo hello world" +) diff --git a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-result.txt b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt new file mode 100644 index 0000000..e791f0a --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning \(dev\) at CMP0040-WARN-missing-target.cmake:2 \(add_custom_command\): + Policy CMP0040 is not set: The target in the TARGET signature of + add_custom_command\(\) must exist. Run "cmake --help-policy CMP0040" for + policy details. Use the cmake_policy command to set the policy and + suppress this warning. ++ + The target name "foobar" is unknown in this context. +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/CMP0040/CMP0040-WARN-missing-target.cmake b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target.cmake new file mode 100644 index 0000000..2c3e401 --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target.cmake @@ -0,0 +1,4 @@ + +add_custom_command(TARGET foobar PRE_BUILD + COMMAND "${CMAKE_COMMAND} -E hello world" +) diff --git a/Tests/RunCMake/CMP0040/CMakeLists.txt b/Tests/RunCMake/CMP0040/CMakeLists.txt new file mode 100644 index 0000000..2f10cb0 --- /dev/null +++ b/Tests/RunCMake/CMP0040/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/CMP0040/RunCMakeTest.cmake b/Tests/RunCMake/CMP0040/RunCMakeTest.cmake new file mode 100644 index 0000000..13160e3 --- /dev/null +++ b/Tests/RunCMake/CMP0040/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +run_cmake(CMP0040-OLD-missing-target) +run_cmake(CMP0040-NEW-missing-target) +run_cmake(CMP0040-WARN-missing-target) + +run_cmake(CMP0040-OLD-existing-target) +run_cmake(CMP0040-NEW-existing-target) diff --git a/Tests/RunCMake/CMP0040/empty.cpp b/Tests/RunCMake/CMP0040/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/CMP0040/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index bb1b909..209b0b3 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -59,6 +59,7 @@ add_RunCMake_test(CMP0028) add_RunCMake_test(CMP0037) add_RunCMake_test(CMP0038) add_RunCMake_test(CMP0039) +add_RunCMake_test(CMP0040) add_RunCMake_test(CTest) if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles") add_RunCMake_test(CompilerChange) |