diff options
author | Nils Gladitz <nilsgladitz@gmail.com> | 2015-03-09 12:12:13 +0100 |
---|---|---|
committer | Nils Gladitz <nilsgladitz@gmail.com> | 2015-03-09 12:45:38 +0100 |
commit | 242c396656783b1b3d542b14bc62710a46a87518 (patch) | |
tree | 8d460b76a2b377433b774815b1914d9b4b86043a /Tests/RunCMake | |
parent | bdb00b36133c64a36fbba7fd6c648725062b6732 (diff) | |
download | cmake-242c396656783b1b3d542b14bc62710a46a87518.tar.gz |
add_custom_command: Diagnose MAIN_DEPENDENCY limitation.
The new policy CMP0057 diagnoses reuse of the same MAIN_DEPENDENCY across
multiple custom commands.
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r-- | Tests/RunCMake/CMP0057/CMP0057-NEW-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0057/CMP0057-NEW.cmake | 13 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0057/CMP0057-OLD.cmake | 13 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt | 9 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0057/CMP0057-WARN.cmake | 11 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake | 8 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0057/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0057/RunCMakeTest.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0057/input.txt | 0 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 1 |
11 files changed, 70 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMP0057/CMP0057-NEW-result.txt b/Tests/RunCMake/CMP0057/CMP0057-NEW-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt b/Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt new file mode 100644 index 0000000000..9607d5460f --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0057-NEW.cmake:8 \(add_custom_command\): + "input.txt" can only be specified as a custom command MAIN_DEPENDENCY once. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0057/CMP0057-NEW.cmake b/Tests/RunCMake/CMP0057/CMP0057-NEW.cmake new file mode 100644 index 0000000000..22dbfb343d --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-NEW.cmake @@ -0,0 +1,13 @@ +cmake_policy(SET CMP0057 NEW) + +add_custom_command(OUTPUT out1 + COMMAND ${CMAKE_COMMAND} -E echo out1 + MAIN_DEPENDENCY input.txt +) + +add_custom_command(OUTPUT out2 + COMMAND ${CMAKE_COMMAND} -E echo out2 + MAIN_DEPENDENCY input.txt +) + +add_custom_target(mytarget1 ALL DEPENDS out1 out2) diff --git a/Tests/RunCMake/CMP0057/CMP0057-OLD.cmake b/Tests/RunCMake/CMP0057/CMP0057-OLD.cmake new file mode 100644 index 0000000000..ccf4fcb3c5 --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-OLD.cmake @@ -0,0 +1,13 @@ +cmake_policy(SET CMP0057 OLD) + +add_custom_command(OUTPUT out1 + COMMAND ${CMAKE_COMMAND} -E echo out1 + MAIN_DEPENDENCY input.txt +) + +add_custom_command(OUTPUT out2 + COMMAND ${CMAKE_COMMAND} -E echo out2 + MAIN_DEPENDENCY input.txt +) + +add_custom_target(mytarget1 ALL DEPENDS out1 out2) diff --git a/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt b/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt new file mode 100644 index 0000000000..da3a1cbf1b --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMP0057-WARN.cmake:6 \(add_custom_command\): + Policy CMP0057 is not set: Disallow multiple MAIN_DEPENDENCY specifications + for the same file. Run "cmake --help-policy CMP0057" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + + "input.txt" can only be specified as a custom command MAIN_DEPENDENCY once. +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/CMP0057/CMP0057-WARN.cmake b/Tests/RunCMake/CMP0057/CMP0057-WARN.cmake new file mode 100644 index 0000000000..1837968b7c --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-WARN.cmake @@ -0,0 +1,11 @@ +add_custom_command(OUTPUT out1 + COMMAND ${CMAKE_COMMAND} -E echo out1 + MAIN_DEPENDENCY input.txt +) + +add_custom_command(OUTPUT out2 + COMMAND ${CMAKE_COMMAND} -E echo out2 + MAIN_DEPENDENCY input.txt +) + +add_custom_target(mytarget1 ALL DEPENDS out1 out2) diff --git a/Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake b/Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake new file mode 100644 index 0000000000..8ce02f96ca --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake @@ -0,0 +1,8 @@ +cmake_policy(SET CMP0057 NEW) + +add_custom_command(OUTPUT out1 + COMMAND ${CMAKE_COMMAND} -E echo out1 + MAIN_DEPENDENCY input.txt +) + +add_custom_target(mytarget1 ALL DEPENDS out1) diff --git a/Tests/RunCMake/CMP0057/CMakeLists.txt b/Tests/RunCMake/CMP0057/CMakeLists.txt new file mode 100644 index 0000000000..ef2163c298 --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0057/RunCMakeTest.cmake b/Tests/RunCMake/CMP0057/RunCMakeTest.cmake new file mode 100644 index 0000000000..f79235f98c --- /dev/null +++ b/Tests/RunCMake/CMP0057/RunCMakeTest.cmake @@ -0,0 +1,7 @@ +include(RunCMake) + +run_cmake(CMP0057-OLD) +run_cmake(CMP0057-NEW) +run_cmake(CMP0057-WARN) + +run_cmake(CMP0057-once_is_ok) diff --git a/Tests/RunCMake/CMP0057/input.txt b/Tests/RunCMake/CMP0057/input.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/Tests/RunCMake/CMP0057/input.txt diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index eb42057402..3bc96c982d 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -63,6 +63,7 @@ add_RunCMake_test(CMP0051) add_RunCMake_test(CMP0053) add_RunCMake_test(CMP0054) add_RunCMake_test(CMP0055) +add_RunCMake_test(CMP0057) add_RunCMake_test(CTest) if(NOT CMake_TEST_EXTERNAL_CMAKE) |