diff options
author | Brad King <brad.king@kitware.com> | 2020-01-27 18:16:20 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-01-27 20:09:18 (GMT) |
commit | dd0a4718fd72d2d7797911d7e3544584ad4268ad (patch) | |
tree | 4027fa8709173fe831334b904a765daad91aba19 /Source | |
parent | 0944caaebbd9bbb3e5f0de44ec975571e3833a1a (diff) | |
download | CMake-dd0a4718fd72d2d7797911d7e3544584ad4268ad.zip CMake-dd0a4718fd72d2d7797911d7e3544584ad4268ad.tar.gz CMake-dd0a4718fd72d2d7797911d7e3544584ad4268ad.tar.bz2 |
Ninja: Fix CMAKE_NINJA_OUTPUT_PATH_PREFIX with Ninja 1.10
The ninja 1.10 tools we use since commit fb18215904 (Ninja: clean ninja
metadata once generated, 2019-05-13) expect `build.ninja` to be
available and loadable. In commit 6cc74b6140 (cmGlobalNinjaGenerator:
avoid cleandead and recompact in Ninja-Multi, 2020-01-22) we added a
condition to exclude the tools in a case where `build.ninja` is not
available. Generalize that condition using a local variable and extend
it for the case that `build.ninja` is not loadable in the current
directory because it is meant to be a sub-ninja for a higher directory.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 2dd89e3..22c0e13 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -549,22 +549,25 @@ void cmGlobalNinjaGenerator::Generate() } }; + // Can the tools below expect 'build.ninja' to be loadable? + bool const expectBuildManifest = + !this->IsMultiConfig() && this->OutputPathPrefix.empty(); + // The `cleandead` tool needs to know about all outputs in the build we just // wrote out. Ninja-Multi doesn't have a single `build.ninja` we can use that // is the union of all generated configurations, so we can't run it reliably // in that case. - if (this->NinjaSupportsCleanDeadTool && !this->IsMultiConfig()) { + if (this->NinjaSupportsCleanDeadTool && expectBuildManifest) { run_ninja_tool({ "cleandead" }); } // The `recompact` tool loads the manifest. As above, we don't have a single // `build.ninja` to load for this in Ninja-Multi. This may be relaxed in the // future pending further investigation into how Ninja works upstream // (ninja#1721). - if (this->NinjaSupportsUnconditionalRecompactTool && - !this->IsMultiConfig()) { + if (this->NinjaSupportsUnconditionalRecompactTool && expectBuildManifest) { run_ninja_tool({ "recompact" }); } - if (this->NinjaSupportsRestatTool) { + if (this->NinjaSupportsRestatTool && this->OutputPathPrefix.empty()) { // XXX(ninja): We only list `build.ninja` entry files here because CMake // *always* rewrites these files on a reconfigure. If CMake ever gets // smarter about this, all CMake-time created/edited files listed as |