From a583b7bc17b30c7772d6ca1909c71c0c14e6fabb Mon Sep 17 00:00:00 2001 From: Daniel Eiband Date: Wed, 11 Sep 2019 18:18:47 +0200 Subject: Genex: Evaluate byproduct generator expressions in cmCustomCommandGenerator Evaluate and expand generator expressions in byproducts of custom commands. Note that it is still not possible to use generator expressions in byproducts of the commands `add_custom_command` and `add_custom_target`. These commands still reject the input. This is a preparation step for OUTPUT generator expression support. Issue: #12877 --- Source/cmCustomCommandGenerator.cxx | 4 +++- Source/cmCustomCommandGenerator.h | 1 + Source/cmMakefileTargetGenerator.cxx | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index d5d7041..ddb855b 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -72,6 +72,8 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc, this->CommandLines.push_back(std::move(argv)); } + AppendPaths(cc.GetByproducts(), *this->GE, this->LG, this->Config, + this->Byproducts); AppendPaths(cc.GetDepends(), *this->GE, this->LG, this->Config, this->Depends); @@ -248,7 +250,7 @@ std::vector const& cmCustomCommandGenerator::GetOutputs() const std::vector const& cmCustomCommandGenerator::GetByproducts() const { - return this->CC.GetByproducts(); + return this->Byproducts; } std::vector const& cmCustomCommandGenerator::GetDepends() const diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index 766f4b8..d614302 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -23,6 +23,7 @@ class cmCustomCommandGenerator cmGeneratorExpression* GE; cmCustomCommandLines CommandLines; std::vector> EmulatorsWithArguments; + std::vector Byproducts; std::vector Depends; std::string WorkingDirectory; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 84e95ef..482af22 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -221,7 +221,8 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() this->GeneratorTarget->GetPostBuildCommands()); for (const auto& be : buildEventCommands) { - const std::vector& byproducts = be.GetByproducts(); + cmCustomCommandGenerator beg(be, this->ConfigName, this->LocalGenerator); + const std::vector& byproducts = beg.GetByproducts(); for (std::string const& byproduct : byproducts) { this->CleanFiles.insert( this->LocalGenerator->MaybeConvertToRelativePath(currentBinDir, -- cgit v0.12