summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/BuildDepends
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-05-19 14:21:11 (GMT)
committerBrad King <brad.king@kitware.com>2021-05-19 17:28:14 (GMT)
commit2725ecff38ccd25905a9bc968bfb1b2f0d09b34a (patch)
tree94dd74aa6b00b3bdddf90e64eace0d6aff7078e5 /Tests/RunCMake/BuildDepends
parentbc40cd7a4e107be68debb01760700850d4c1106c (diff)
downloadCMake-2725ecff38ccd25905a9bc968bfb1b2f0d09b34a.zip
CMake-2725ecff38ccd25905a9bc968bfb1b2f0d09b34a.tar.gz
CMake-2725ecff38ccd25905a9bc968bfb1b2f0d09b34a.tar.bz2
Ninja: Handle depfiles with absolute paths to generated files
Ninja treats every (normalized) path as its own node. It does not recognize `/abs/path/to/file` in a depfile as matching `path/to/file` even when `build.ninja` and the working directory are in `/abs/`. See Ninja Issue 1251. In cases where we pass absolute paths to the compiler, it will write a depfile containing absolute paths. If those files are generated in the build tree by custom commands, `build.ninja` references them by relative path in build statement outputs, so Ninja does not hook up the dependency and rebuild the project correctly. Add infrastructure to work around this problem by adding implicit outputs to custom command build statements that reference the main outputs by absolute path. Use a `${cmake_ninja_workdir}` placeholder to avoid repeating the base path. For example: build out.txt | ${cmake_ninja_workdir}out.txt: CUSTOM_COMMAND ... Ninja will create two nodes for the output file, one with a relative path and one with an absolute path. A depfile may then mention either form of the path and Ninja will hook up the dependency. Unfortunately Ninja will also stat the file twice. Issue: #13894 Fixes: #21865
Diffstat (limited to 'Tests/RunCMake/BuildDepends')
-rw-r--r--Tests/RunCMake/BuildDepends/RunCMakeTest.cmake2
1 files changed, 1 insertions, 1 deletions
diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
index 947a2fe..0a80580 100644
--- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
+++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
@@ -183,7 +183,7 @@ if(RunCMake_GENERATOR MATCHES "Make")
endif()
if(RunCMake_GENERATOR MATCHES "^Visual Studio 9 " OR
- RunCMake_GENERATOR MATCHES "Ninja")
+ (RunCMake_GENERATOR MATCHES "Ninja" AND ninja_version VERSION_LESS 1.7))
# This build tool misses the dependency.
set(run_BuildDepends_skip_step_2 1)
endif()