summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/Ninja
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-04-25 15:33:53 (GMT)
committerBrad King <brad.king@kitware.com>2018-04-26 12:40:57 (GMT)
commit625b8f9076080b3831ef7821812461b694ef5586 (patch)
treeece0e5a7e100f9f65e725097235e575f6e1990f2 /Tests/RunCMake/Ninja
parentae6722483e8e1b64cf05d5186c6240d724ad409e (diff)
downloadCMake-625b8f9076080b3831ef7821812461b694ef5586.zip
CMake-625b8f9076080b3831ef7821812461b694ef5586.tar.gz
CMake-625b8f9076080b3831ef7821812461b694ef5586.tar.bz2
Ninja: Avoid empty phony edges for target ordering
Since commit v3.9.0-rc1~230^2~2 (ninja: break unnecessary target dependencies, 2017-04-17) we unconditionally generate a phony edge for target ordering. It is needed in case a later target depends on it. However, if the phony edge has no inputs then `ninja -d explain` prints: ninja explain: output ... of phony edge with no inputs doesn't exist Furthermore the phony edge's output is considered dirty and can cause dependents to be incorrectly considered dirty. Avoid this by always generating at least one input to the target ordering phony edges. If we have no real dependencies just use a path that always exists. Fixes: #17942
Diffstat (limited to 'Tests/RunCMake/Ninja')
-rw-r--r--Tests/RunCMake/Ninja/NoWorkToDo-nowork-stdout.txt1
-rw-r--r--Tests/RunCMake/Ninja/NoWorkToDo.cmake2
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake9
3 files changed, 12 insertions, 0 deletions
diff --git a/Tests/RunCMake/Ninja/NoWorkToDo-nowork-stdout.txt b/Tests/RunCMake/Ninja/NoWorkToDo-nowork-stdout.txt
new file mode 100644
index 0000000..60a9228
--- /dev/null
+++ b/Tests/RunCMake/Ninja/NoWorkToDo-nowork-stdout.txt
@@ -0,0 +1 @@
+^ninja: no work to do
diff --git a/Tests/RunCMake/Ninja/NoWorkToDo.cmake b/Tests/RunCMake/Ninja/NoWorkToDo.cmake
new file mode 100644
index 0000000..a2fa0cb
--- /dev/null
+++ b/Tests/RunCMake/Ninja/NoWorkToDo.cmake
@@ -0,0 +1,2 @@
+enable_language(C)
+add_executable(hello hello.c)
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 3bb2b6b..b6e6cd4 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -21,6 +21,15 @@ function(run_NinjaToolMissing)
endfunction()
run_NinjaToolMissing()
+function(run_NoWorkToDo)
+ run_cmake(NoWorkToDo)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/NoWorkToDo-build)
+ run_cmake_command(NoWorkToDo-build ${CMAKE_COMMAND} --build .)
+ run_cmake_command(NoWorkToDo-nowork ${CMAKE_COMMAND} --build . -- -d explain)
+endfunction()
+run_NoWorkToDo()
+
function(run_CMP0058 case)
# Use a single build tree for a few tests without cleaning.
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0058-${case}-build)