summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpressionEvaluator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-07 19:41:39 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-10-07 19:41:39 (GMT)
commit058af7a6ce3f9df093fae3d68484c1305c6c985a (patch)
tree330680e750b878048e783c810362146fb51025ae /Source/cmGeneratorExpressionEvaluator.cxx
parentea3bb7ed9a8a2b278c1aa9c4435e9f12f515535c (diff)
parentdcc00ece4b297f94974b84783805af9c01b6e681 (diff)
downloadCMake-058af7a6ce3f9df093fae3d68484c1305c6c985a.zip
CMake-058af7a6ce3f9df093fae3d68484c1305c6c985a.tar.gz
CMake-058af7a6ce3f9df093fae3d68484c1305c6c985a.tar.bz2
Merge topic 'PLATFORM_ID-genex'
dcc00ec Genex: Add the PLATFORM_ID expression.
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluator.cxx')
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index abe4e70..7fd0fdc 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -438,6 +438,39 @@ static const struct CxxCompilerVersionNode : public CompilerVersionNode
//----------------------------------------------------------------------------
+struct PlatformIdNode : public cmGeneratorExpressionNode
+{
+ PlatformIdNode() {}
+
+ virtual int NumExpectedParameters() const { return ZeroOrMoreParameters; }
+
+ std::string Evaluate(const std::vector<std::string> &parameters,
+ cmGeneratorExpressionContext *context,
+ const GeneratorExpressionContent *,
+ cmGeneratorExpressionDAGChecker *) const
+ {
+ const char *platformId = context->Makefile ?
+ context->Makefile->GetSafeDefinition(
+ "CMAKE_SYSTEM_NAME") : "";
+ if (parameters.size() == 0)
+ {
+ return platformId ? platformId : "";
+ }
+
+ if (!platformId)
+ {
+ return parameters.front().empty() ? "1" : "0";
+ }
+
+ if (cmsysString_strcasecmp(parameters.begin()->c_str(), platformId) == 0)
+ {
+ return "1";
+ }
+ return "0";
+ }
+} platformIdNode;
+
+//----------------------------------------------------------------------------
static const struct VersionGreaterNode : public cmGeneratorExpressionNode
{
VersionGreaterNode() {}
@@ -1356,6 +1389,8 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
return &cCompilerVersionNode;
else if (identifier == "CXX_COMPILER_VERSION")
return &cxxCompilerVersionNode;
+ else if (identifier == "PLATFORM_ID")
+ return &platformIdNode;
else if (identifier == "CONFIGURATION")
return &configurationNode;
else if (identifier == "CONFIG")