summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaUtilityTargetGenerator.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/cmNinjaUtilityTargetGenerator.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/cmNinjaUtilityTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaUtilityTargetGenerator.cxx15
1 files changed, 5 insertions, 10 deletions
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx
index 6297252..1f5a7ff 100644
--- a/Source/cmNinjaUtilityTargetGenerator.cxx
+++ b/Source/cmNinjaUtilityTargetGenerator.cxx
@@ -73,7 +73,8 @@ void cmNinjaUtilityTargetGenerator::WriteUtilBuildStatements(
cmNinjaBuild phonyBuild("phony");
std::vector<std::string> commands;
cmNinjaDeps deps;
- cmNinjaDeps util_outputs(1, utilCommandName);
+ cmGlobalNinjaGenerator::CCOutputs util_outputs(gg);
+ util_outputs.ExplicitOuts.emplace_back(utilCommandName);
bool uses_terminal = false;
{
@@ -86,10 +87,7 @@ void cmNinjaUtilityTargetGenerator::WriteUtilBuildStatements(
cmCustomCommandGenerator ccg(ci, fileConfig, lg);
lg->AppendCustomCommandDeps(ccg, deps, fileConfig);
lg->AppendCustomCommandLines(ccg, commands);
- std::vector<std::string> const& ccByproducts = ccg.GetByproducts();
- std::transform(ccByproducts.begin(), ccByproducts.end(),
- std::back_inserter(util_outputs),
- this->MapToNinjaPath());
+ util_outputs.Add(ccg.GetByproducts());
if (ci.GetUsesTerminal()) {
uses_terminal = true;
}
@@ -124,7 +122,8 @@ void cmNinjaUtilityTargetGenerator::WriteUtilBuildStatements(
if (genTarget->Target->GetType() != cmStateEnums::GLOBAL_TARGET) {
lg->AppendTargetOutputs(genTarget, gg->GetByproductsForCleanTarget(),
config);
- std::copy(util_outputs.begin(), util_outputs.end(),
+ std::copy(util_outputs.ExplicitOuts.begin(),
+ util_outputs.ExplicitOuts.end(),
std::back_inserter(gg->GetByproductsForCleanTarget()));
}
lg->AppendTargetDepends(genTarget, deps, config, fileConfig,
@@ -166,10 +165,6 @@ void cmNinjaUtilityTargetGenerator::WriteUtilBuildStatements(
return;
}
- for (std::string const& util_output : util_outputs) {
- gg->SeenCustomCommandOutput(util_output);
- }
-
std::string ccConfig;
if (genTarget->Target->IsPerConfig() &&
genTarget->GetType() != cmStateEnums::GLOBAL_TARGET) {