summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorDaniel Eiband <daniel.eiband@brainlab.com>2019-09-22 07:53:44 (GMT)
committerDaniel Eiband <daniel.eiband@brainlab.com>2019-09-23 19:19:15 (GMT)
commit7dcf9cb83c2082168f218be8f21b95b77cc95a86 (patch)
treeee1435acc933654c5d643e3ca5777670407f2cb1 /Source/cmGeneratorTarget.cxx
parentc7c59dae82594557dc2fddc4ef881dafeaad076a (diff)
downloadCMake-7dcf9cb83c2082168f218be8f21b95b77cc95a86.zip
CMake-7dcf9cb83c2082168f218be8f21b95b77cc95a86.tar.gz
CMake-7dcf9cb83c2082168f218be8f21b95b77cc95a86.tar.bz2
cmGeneratorExpression: Add cmGeneratorExpression::Evaluate utility
cmGeneratorExpression::Evaluate is a shortcut when only the evaluated string is needed or an instance of cmCompiledGeneratorExpression cannot be cached. Fixes: #19686
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx53
1 files changed, 21 insertions, 32 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index b66d9d5..350d28f 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -487,9 +487,8 @@ std::string cmGeneratorTarget::GetOutputName(
}
// Now evaluate genex and update the previously-prepared map entry.
- cmGeneratorExpression ge;
- std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outName);
- i->second = cge->Evaluate(this->LocalGenerator, config);
+ i->second =
+ cmGeneratorExpression::Evaluate(outName, this->LocalGenerator, config);
} else if (i->second.empty()) {
// An empty map entry indicates we have been called recursively
// from the above block.
@@ -709,9 +708,8 @@ void handleSystemIncludesDep(cmLocalGenerator* lg,
{
if (const char* dirs =
depTgt->GetProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES")) {
- cmGeneratorExpression ge;
- cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, headTarget, dagChecker,
- depTgt, language),
+ cmExpandList(cmGeneratorExpression::Evaluate(dirs, lg, config, headTarget,
+ dagChecker, depTgt, language),
result);
}
if (!depTgt->IsImported() || excludeImported) {
@@ -720,9 +718,8 @@ void handleSystemIncludesDep(cmLocalGenerator* lg,
if (const char* dirs =
depTgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES")) {
- cmGeneratorExpression ge;
- cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, headTarget, dagChecker,
- depTgt, language),
+ cmExpandList(cmGeneratorExpression::Evaluate(dirs, lg, config, headTarget,
+ dagChecker, depTgt, language),
result);
}
}
@@ -1092,9 +1089,9 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(
std::vector<std::string> result;
for (std::string const& it : this->Target->GetSystemIncludeDirectories()) {
- cmGeneratorExpression ge;
- cmExpandList(ge.Parse(it)->Evaluate(this->LocalGenerator, config, this,
- &dagChecker, nullptr, language),
+ cmExpandList(cmGeneratorExpression::Evaluate(it, this->LocalGenerator,
+ config, this, &dagChecker,
+ nullptr, language),
result);
}
@@ -2515,13 +2512,12 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string>& result,
if (!prop) {
return;
}
- cmGeneratorExpression ge;
cmGeneratorExpressionDAGChecker dagChecker(this, "AUTOUIC_OPTIONS", nullptr,
nullptr);
- cmExpandList(
- ge.Parse(prop)->Evaluate(this->LocalGenerator, config, this, &dagChecker),
- result);
+ cmExpandList(cmGeneratorExpression::Evaluate(prop, this->LocalGenerator,
+ config, this, &dagChecker),
+ result);
}
void processILibs(const std::string& config,
@@ -5552,18 +5548,15 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
// Select an output directory.
if (const char* config_outdir = this->GetProperty(configProp)) {
// Use the user-specified per-configuration output directory.
- cmGeneratorExpression ge;
- std::unique_ptr<cmCompiledGeneratorExpression> cge =
- ge.Parse(config_outdir);
- out = cge->Evaluate(this->LocalGenerator, config);
+ out = cmGeneratorExpression::Evaluate(config_outdir, this->LocalGenerator,
+ config);
// Skip per-configuration subdirectory.
conf.clear();
} else if (const char* outdir = this->GetProperty(propertyName)) {
// Use the user-specified output directory.
- cmGeneratorExpression ge;
- std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outdir);
- out = cge->Evaluate(this->LocalGenerator, config);
+ out =
+ cmGeneratorExpression::Evaluate(outdir, this->LocalGenerator, config);
// Skip per-configuration subdirectory if the value contained a
// generator expression.
@@ -5631,18 +5624,15 @@ bool cmGeneratorTarget::ComputePDBOutputDir(const std::string& kind,
// Select an output directory.
if (const char* config_outdir = this->GetProperty(configProp)) {
// Use the user-specified per-configuration output directory.
- cmGeneratorExpression ge;
- std::unique_ptr<cmCompiledGeneratorExpression> cge =
- ge.Parse(config_outdir);
- out = cge->Evaluate(this->LocalGenerator, config);
+ out = cmGeneratorExpression::Evaluate(config_outdir, this->LocalGenerator,
+ config);
// Skip per-configuration subdirectory.
conf.clear();
} else if (const char* outdir = this->GetProperty(propertyName)) {
// Use the user-specified output directory.
- cmGeneratorExpression ge;
- std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outdir);
- out = cge->Evaluate(this->LocalGenerator, config);
+ out =
+ cmGeneratorExpression::Evaluate(outdir, this->LocalGenerator, config);
// Skip per-configuration subdirectory if the value contained a
// generator expression.
@@ -5697,8 +5687,7 @@ bool cmGeneratorTarget::GetRPATH(const std::string& config,
return false;
}
- cmGeneratorExpression ge;
- rpath = ge.Parse(value)->Evaluate(this->LocalGenerator, config);
+ rpath = cmGeneratorExpression::Evaluate(value, this->LocalGenerator, config);
return true;
}