diff options
author | Brad King <brad.king@kitware.com> | 2014-07-21 17:02:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-07-21 17:02:22 (GMT) |
commit | 807e4ffeefb0e10ef0546e0eb7383f3d5533809b (patch) | |
tree | 0faa99cb8c0479245755fa2e4347ae47a91872ac /Source | |
parent | 46099b82ed71394f1dc6e0bbb91704d274edab7d (diff) | |
download | CMake-807e4ffeefb0e10ef0546e0eb7383f3d5533809b.zip CMake-807e4ffeefb0e10ef0546e0eb7383f3d5533809b.tar.gz CMake-807e4ffeefb0e10ef0546e0eb7383f3d5533809b.tar.bz2 |
Genex: Track whether an expression depends on the 'head' target
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorExpression.cxx | 3 | ||||
-rw-r--r-- | Source/cmGeneratorExpression.h | 5 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.cxx | 14 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.h | 1 |
4 files changed, 23 insertions, 0 deletions
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 2b4d955..7fc1464 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -97,6 +97,7 @@ const char *cmCompiledGeneratorExpression::Evaluate( context.Quiet = quiet; context.HadError = false; context.HadContextSensitiveCondition = false; + context.HadHeadSensitiveCondition = false; context.HeadTarget = headTarget; context.EvaluateForBuildsystem = this->EvaluateForBuildsystem; context.CurrentTarget = currentTarget ? currentTarget : headTarget; @@ -124,6 +125,7 @@ const char *cmCompiledGeneratorExpression::Evaluate( if (!context.HadError) { this->HadContextSensitiveCondition = context.HadContextSensitiveCondition; + this->HadHeadSensitiveCondition = context.HadHeadSensitiveCondition; } this->DependTargets = context.DependTargets; @@ -137,6 +139,7 @@ cmCompiledGeneratorExpression::cmCompiledGeneratorExpression( const std::string& input) : Backtrace(backtrace), Input(input), HadContextSensitiveCondition(false), + HadHeadSensitiveCondition(false), EvaluateForBuildsystem(false) { cmGeneratorExpressionLexer l; diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 324d23c..b952520 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -111,6 +111,10 @@ public: { return this->HadContextSensitiveCondition; } + bool GetHadHeadSensitiveCondition() const + { + return this->HadHeadSensitiveCondition; + } void SetEvaluateForBuildsystem(bool eval) { @@ -141,6 +145,7 @@ private: MaxLanguageStandard; mutable std::string Output; mutable bool HadContextSensitiveCondition; + mutable bool HadHeadSensitiveCondition; bool EvaluateForBuildsystem; }; diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 28879f1..7a53d65 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -840,6 +840,10 @@ getLinkedTargetsContent( { context->HadContextSensitiveCondition = true; } + if (cge->GetHadHeadSensitiveCondition()) + { + context->HadHeadSensitiveCondition = true; + } } linkedTargetsContent = cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent); @@ -871,6 +875,10 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode cmTarget const* target = context->HeadTarget; std::string propertyName = *parameters.begin(); + if (parameters.size() == 1) + { + context->HadHeadSensitiveCondition = true; + } if (!target && parameters.size() == 1) { reportError(context, content->GetOriginalExpression(), @@ -1190,6 +1198,10 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode { context->HadContextSensitiveCondition = true; } + if (cge->GetHadHeadSensitiveCondition()) + { + context->HadHeadSensitiveCondition = true; + } if (!linkedTargetsContent.empty()) { result += (result.empty() ? "" : ";") + linkedTargetsContent; @@ -1313,6 +1325,7 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode "not be used with add_custom_command or add_custom_target."); return std::string(); } + context->HadHeadSensitiveCondition = true; typedef std::map<std::string, std::vector<std::string> > LangMap; static LangMap availableFeatures; @@ -1446,6 +1459,7 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode } context->HadContextSensitiveCondition = true; + context->HadHeadSensitiveCondition = true; for (size_t i = 1; i < cmArraySize(targetPolicyWhitelist); ++i) { diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index 0ffb860..8a529e8 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -41,6 +41,7 @@ struct cmGeneratorExpressionContext bool Quiet; bool HadError; bool HadContextSensitiveCondition; + bool HadHeadSensitiveCondition; bool EvaluateForBuildsystem; }; |