summaryrefslogtreecommitdiff
path: root/Source/cmGeneratorExpression.h
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@sap.com>2017-12-13 16:34:11 +0100
committerMarc Chevrier <marc.chevrier@sap.com>2017-12-13 16:35:22 +0100
commit10f58b27ac1015e4f1615372bb5168e43afcdf3a (patch)
tree8f1db98fd525f9a4039fd9a0194b009d208a4acc /Source/cmGeneratorExpression.h
parent14fe6d431b12139ea2aeb5bcc09efd0f964597aa (diff)
downloadcmake-10f58b27ac1015e4f1615372bb5168e43afcdf3a.tar.gz
Genex: Per-source $<COMPILE_LANGUAGE:...> support
Fixes: #17542
Diffstat (limited to 'Source/cmGeneratorExpression.h')
-rw-r--r--Source/cmGeneratorExpression.h47
1 files changed, 41 insertions, 6 deletions
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 611fbf89fc..9fd53c67e5 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -160,25 +160,38 @@ class cmGeneratorExpressionInterpreter
public:
cmGeneratorExpressionInterpreter(cmLocalGenerator* localGenerator,
cmGeneratorTarget* generatorTarget,
- const std::string& config)
+ const std::string& config,
+ const std::string& target,
+ const std::string& lang)
: LocalGenerator(localGenerator)
, GeneratorTarget(generatorTarget)
, Config(config)
+ , Target(target)
+ , Language(lang)
+ {
+ }
+ cmGeneratorExpressionInterpreter(cmLocalGenerator* localGenerator,
+ cmGeneratorTarget* generatorTarget,
+ const std::string& config)
+ : cmGeneratorExpressionInterpreter(localGenerator, generatorTarget, config,
+ std::string(), std::string())
{
}
const char* Evaluate(const char* expression)
{
- this->CompiledGeneratorExpression =
- this->GeneratorExpression.Parse(expression);
-
- return this->CompiledGeneratorExpression->Evaluate(
- this->LocalGenerator, this->Config, false, this->GeneratorTarget);
+ return this->EvaluateExpression(expression);
}
const char* Evaluate(const std::string& expression)
{
return this->Evaluate(expression.c_str());
}
+ const char* Evaluate(const char* expression, const std::string& property);
+ const char* Evaluate(const std::string& expression,
+ const std::string& property)
+ {
+ return this->Evaluate(expression.c_str(), property);
+ }
protected:
cmGeneratorExpression& GetGeneratorExpression()
@@ -195,12 +208,34 @@ protected:
cmGeneratorTarget* GetGeneratorTarget() { return this->GeneratorTarget; }
+ const std::string& GetTargetName() const { return this->Target; }
+ const std::string& GetLanguage() const { return this->Language; }
+
+ const char* EvaluateExpression(
+ const char* expression,
+ cmGeneratorExpressionDAGChecker* dagChecker = nullptr)
+ {
+ this->CompiledGeneratorExpression =
+ this->GeneratorExpression.Parse(expression);
+
+ if (dagChecker == nullptr) {
+ return this->CompiledGeneratorExpression->Evaluate(
+ this->LocalGenerator, this->Config, false, this->GeneratorTarget);
+ }
+
+ return this->CompiledGeneratorExpression->Evaluate(
+ this->LocalGenerator, this->Config, false, this->GeneratorTarget,
+ dagChecker, this->Language);
+ }
+
private:
cmGeneratorExpression GeneratorExpression;
std::unique_ptr<cmCompiledGeneratorExpression> CompiledGeneratorExpression;
cmLocalGenerator* LocalGenerator = nullptr;
cmGeneratorTarget* GeneratorTarget = nullptr;
std::string Config;
+ std::string Target;
+ std::string Language;
};
#endif