diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2020-01-22 15:24:57 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-01-22 15:25:06 (GMT) |
commit | 593d0f3a578a51775d6402064ec53dce42b4d82c (patch) | |
tree | 92e896f82fd4bbda5c770bfff704c10b307a3912 /Source | |
parent | 15c573df4115ab1be01da118c91b4d942e9007d6 (diff) | |
parent | eb2da206d94dcfcb579036969145a8bdb52e7e72 (diff) | |
download | CMake-593d0f3a578a51775d6402064ec53dce42b4d82c.zip CMake-593d0f3a578a51775d6402064ec53dce42b4d82c.tar.gz CMake-593d0f3a578a51775d6402064ec53dce42b4d82c.tar.bz2 |
Merge topic 'ninja-restat-just-build.ninja'
eb2da206d9 cmGlobalNinjaGenerator: only restat build.ninja
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4245
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 0487ad1..1f83ec5 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -531,11 +531,13 @@ void cmGlobalNinjaGenerator::Generate() return; } - auto run_ninja_tool = [this](char const* tool) { + auto run_ninja_tool = [this](std::vector<char const*> const& args) { std::vector<std::string> command; command.push_back(this->NinjaCommand); command.emplace_back("-t"); - command.emplace_back(tool); + for (auto const& arg : args) { + command.emplace_back(arg); + } std::string error; if (!cmSystemTools::RunSingleCommand(command, nullptr, &error, nullptr, nullptr, @@ -551,13 +553,25 @@ void cmGlobalNinjaGenerator::Generate() }; if (this->NinjaSupportsCleanDeadTool) { - run_ninja_tool("cleandead"); + run_ninja_tool({ "cleandead" }); } if (this->NinjaSupportsUnconditionalRecompactTool) { - run_ninja_tool("recompact"); + run_ninja_tool({ "recompact" }); } if (this->NinjaSupportsRestatTool) { - run_ninja_tool("restat"); + // 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 + // outputs for the reconfigure build statement will need to be listed here. + cmNinjaDeps outputs; + this->AddRebuildManifestOutputs(outputs); + std::vector<const char*> args; + args.reserve(outputs.size() + 1); + args.push_back("restat"); + for (auto const& output : outputs) { + args.push_back(output.c_str()); + } + run_ninja_tool(args); } } |