diff options
author | Brad King <brad.king@kitware.com> | 2021-05-18 15:43:11 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-05-19 16:07:58 (GMT) |
commit | 68e5f92cada35068f71a8c46388aeb4eb1383bca (patch) | |
tree | 0dc3f33c8c7a3b8bc86d6360b819924b7ddc65df /Source/cmNinjaUtilityTargetGenerator.cxx | |
parent | c5195193d3525dc2b661757e0039486e39b94f27 (diff) | |
download | CMake-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.cxx | 15 |
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) { |