From 947ba01bf987bce09c2fdd5e2547f79af2c5844b Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 16 Oct 2020 09:55:54 -0400 Subject: cmLocalGenerator: Factor out helper to expand custom command output paths --- Source/cmCustomCommandGenerator.cxx | 6 +----- Source/cmLocalGenerator.cxx | 10 ++++++++++ Source/cmLocalGenerator.h | 4 ++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index cc0419d..64cd88e 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -53,11 +53,7 @@ std::vector EvaluateOutputs(std::vector const& paths, std::vector outputs; for (std::string const& p : paths) { std::unique_ptr cge = ge.Parse(p); - std::string const& ep = cge->Evaluate(lg, config); - cm::append(outputs, cmExpandedList(ep)); - } - for (std::string& p : outputs) { - p = cmSystemTools::CollapseFullPath(p, lg->GetCurrentBinaryDirectory()); + cm::append(outputs, lg->ExpandCustomCommandOutputPaths(*cge, config)); } return outputs; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 832c36c..8a9cb04 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -4169,6 +4169,16 @@ cmSourceFile* cmLocalGenerator::GetSourceFileWithOutput( return nullptr; } +std::vector cmLocalGenerator::ExpandCustomCommandOutputPaths( + cmCompiledGeneratorExpression const& cge, std::string const& config) +{ + std::vector paths = cmExpandedList(cge.Evaluate(this, config)); + for (std::string& p : paths) { + p = cmSystemTools::CollapseFullPath(p, this->GetCurrentBinaryDirectory()); + } + return paths; +} + void cmLocalGenerator::AddTargetByproducts( cmTarget* target, const std::vector& byproducts) { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 9ed3b15..c246e2e 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -22,6 +22,7 @@ #include "cmProperty.h" #include "cmStateSnapshot.h" +class cmCompiledGeneratorExpression; class cmComputeLinkInformation; class cmCustomCommandGenerator; class cmCustomCommandLines; @@ -362,6 +363,9 @@ public: bool command_expand_lists = false, const std::string& job_pool = "", bool stdPipesUTF8 = false); + std::vector ExpandCustomCommandOutputPaths( + cmCompiledGeneratorExpression const& cge, std::string const& config); + /** * Add target byproducts. */ -- cgit v0.12