summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalNinjaGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-05-18 15:43:11 (GMT)
committerBrad King <brad.king@kitware.com>2021-05-19 16:07:58 (GMT)
commit68e5f92cada35068f71a8c46388aeb4eb1383bca (patch)
tree0dc3f33c8c7a3b8bc86d6360b819924b7ddc65df /Source/cmLocalNinjaGenerator.cxx
parentc5195193d3525dc2b661757e0039486e39b94f27 (diff)
downloadCMake-68e5f92cada35068f71a8c46388aeb4eb1383bca.zip
CMake-68e5f92cada35068f71a8c46388aeb4eb1383bca.tar.gz
CMake-68e5f92cada35068f71a8c46388aeb4eb1383bca.tar.bz2
cmGlobalNinjaGenerator: Factor out custom command output collection
De-duplicate code paths calling ConvertToNinjaPath and SeenCustomCommandOutput on custom command outputs and custom target byproducts.
Diffstat (limited to 'Source/cmLocalNinjaGenerator.cxx')
-rw-r--r--Source/cmLocalNinjaGenerator.cxx20
1 files changed, 6 insertions, 14 deletions
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index a2090cf..9eb3e46 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -638,18 +638,11 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
}
}
- cmNinjaDeps ninjaOutputs(outputs.size() + byproducts.size());
- std::transform(outputs.begin(), outputs.end(), ninjaOutputs.begin(),
- gg->MapToNinjaPath());
- std::transform(byproducts.begin(), byproducts.end(),
- ninjaOutputs.begin() + outputs.size(),
- gg->MapToNinjaPath());
-
- for (std::string const& ninjaOutput : ninjaOutputs) {
- gg->SeenCustomCommandOutput(ninjaOutput);
- }
+ cmGlobalNinjaGenerator::CCOutputs ccOutputs(gg);
+ ccOutputs.Add(outputs);
+ ccOutputs.Add(byproducts);
- std::string mainOutput = ninjaOutputs[0];
+ std::string mainOutput = ccOutputs.ExplicitOuts[0];
cmNinjaDeps ninjaDeps;
this->AppendCustomCommandDeps(ccg, ninjaDeps, fileConfig);
@@ -660,7 +653,7 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
if (cmdLines.empty()) {
cmNinjaBuild build("phony");
build.Comment = cmStrCat("Phony custom command for ", mainOutput);
- build.Outputs = std::move(ninjaOutputs);
+ build.Outputs = std::move(ccOutputs.ExplicitOuts);
build.ExplicitDeps = std::move(ninjaDeps);
build.OrderOnlyDeps = orderOnlyDeps;
gg->WriteBuild(this->GetImplFileStream(fileConfig), build);
@@ -710,8 +703,7 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
this->ConstructComment(ccg), comment, depfile, cc->GetJobPool(),
cc->GetUsesTerminal(),
/*restat*/ !symbolic || !byproducts.empty(), fileConfig,
- std::move(ninjaOutputs), std::move(ninjaDeps),
- std::move(orderOnlyDeps));
+ std::move(ccOutputs), std::move(ninjaDeps), std::move(orderOnlyDeps));
}
}
}