1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-16 22:37:30 +08:00

cmLocalGenerator: Factor out helper to expand custom command output paths

This commit is contained in:
Brad King
2020-10-16 09:55:54 -04:00
parent 1902d28ebc
commit 947ba01bf9
3 changed files with 15 additions and 5 deletions

View File

@@ -53,11 +53,7 @@ std::vector<std::string> EvaluateOutputs(std::vector<std::string> const& paths,
std::vector<std::string> outputs; std::vector<std::string> outputs;
for (std::string const& p : paths) { for (std::string const& p : paths) {
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(p); std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(p);
std::string const& ep = cge->Evaluate(lg, config); cm::append(outputs, lg->ExpandCustomCommandOutputPaths(*cge, config));
cm::append(outputs, cmExpandedList(ep));
}
for (std::string& p : outputs) {
p = cmSystemTools::CollapseFullPath(p, lg->GetCurrentBinaryDirectory());
} }
return outputs; return outputs;
} }

View File

@@ -4169,6 +4169,16 @@ cmSourceFile* cmLocalGenerator::GetSourceFileWithOutput(
return nullptr; return nullptr;
} }
std::vector<std::string> cmLocalGenerator::ExpandCustomCommandOutputPaths(
cmCompiledGeneratorExpression const& cge, std::string const& config)
{
std::vector<std::string> paths = cmExpandedList(cge.Evaluate(this, config));
for (std::string& p : paths) {
p = cmSystemTools::CollapseFullPath(p, this->GetCurrentBinaryDirectory());
}
return paths;
}
void cmLocalGenerator::AddTargetByproducts( void cmLocalGenerator::AddTargetByproducts(
cmTarget* target, const std::vector<std::string>& byproducts) cmTarget* target, const std::vector<std::string>& byproducts)
{ {

View File

@@ -22,6 +22,7 @@
#include "cmProperty.h" #include "cmProperty.h"
#include "cmStateSnapshot.h" #include "cmStateSnapshot.h"
class cmCompiledGeneratorExpression;
class cmComputeLinkInformation; class cmComputeLinkInformation;
class cmCustomCommandGenerator; class cmCustomCommandGenerator;
class cmCustomCommandLines; class cmCustomCommandLines;
@@ -362,6 +363,9 @@ public:
bool command_expand_lists = false, const std::string& job_pool = "", bool command_expand_lists = false, const std::string& job_pool = "",
bool stdPipesUTF8 = false); bool stdPipesUTF8 = false);
std::vector<std::string> ExpandCustomCommandOutputPaths(
cmCompiledGeneratorExpression const& cge, std::string const& config);
/** /**
* Add target byproducts. * Add target byproducts.
*/ */