summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpressionEvaluator.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-02-22 16:43:13 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-03-07 12:19:45 (GMT)
commite387ce7d681f9bd6c90c41f34b7500dfeb3b32ba (patch)
tree0ba79cecd48ff485649045fcfdde434492c8ecb5 /Source/cmGeneratorExpressionEvaluator.cxx
parent4a0128f42feb7da9b6bebe0c2c3aa7a756b96822 (diff)
downloadCMake-e387ce7d681f9bd6c90c41f34b7500dfeb3b32ba.zip
CMake-e387ce7d681f9bd6c90c41f34b7500dfeb3b32ba.tar.gz
CMake-e387ce7d681f9bd6c90c41f34b7500dfeb3b32ba.tar.bz2
Genex: Add a COMPILE_LANGUAGE generator expression.
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluator.cxx')
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx32
1 files changed, 31 insertions, 1 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index ba18faa..63a46f2 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -16,6 +16,7 @@
#include "cmGeneratorExpressionDAGChecker.h"
#include "cmGeneratorExpression.h"
#include "cmLocalGenerator.h"
+#include "cmGlobalGenerator.h"
#include "cmSourceFile.h"
#include <cmsys/String.h>
@@ -89,7 +90,8 @@ std::string cmGeneratorExpressionNode::EvaluateDependentExpression(
context->Quiet,
headTarget,
currentTarget,
- dagChecker);
+ dagChecker,
+ context->Language);
if (cge->GetHadContextSensitiveCondition())
{
context->HadContextSensitiveCondition = true;
@@ -806,6 +808,33 @@ static const struct JoinNode : public cmGeneratorExpressionNode
}
} joinNode;
+static const struct CompileLanguageNode : public cmGeneratorExpressionNode
+{
+ CompileLanguageNode() {}
+
+ virtual int NumExpectedParameters() const { return OneOrZeroParameters; }
+
+ std::string Evaluate(const std::vector<std::string> &parameters,
+ cmGeneratorExpressionContext *context,
+ const GeneratorExpressionContent *content,
+ cmGeneratorExpressionDAGChecker *) const
+ {
+ if(context->Language.empty())
+ {
+ reportError(context, content->GetOriginalExpression(),
+ "$<COMPILE_LANGUAGE:...> may only be used to specify include "
+ "directories compile definitions, compile options and to evaluate "
+ "components of the file(GENERATE) command.");
+ return std::string();
+ }
+ if (parameters.empty())
+ {
+ return context->Language;
+ }
+ return context->Language == parameters.front() ? "1" : "0";
+ }
+} languageNode;
+
#define TRANSITIVE_PROPERTY_NAME(PROPERTY) \
, "INTERFACE_" #PROPERTY
@@ -1829,6 +1858,7 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
nodeMap["INSTALL_PREFIX"] = &installPrefixNode;
nodeMap["JOIN"] = &joinNode;
nodeMap["LINK_ONLY"] = &linkOnlyNode;
+ nodeMap["COMPILE_LANGUAGE"] = &languageNode;
}
NodeMap::const_iterator i = nodeMap.find(identifier);
if (i == nodeMap.end())