[Cmake-commits] CMake branch, next, updated. v2.8.11.2-4021-g88e9465

Stephen Kelly steveire at gmail.com
Wed Aug 28 04:25:08 EDT 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  88e94650dc5781d842fef548d5d0feb5a7fccb45 (commit)
       via  dcc00ece4b297f94974b84783805af9c01b6e681 (commit)
      from  49bc87ec8559deb4fbce95a54b1688cdfbda8f3f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=88e94650dc5781d842fef548d5d0feb5a7fccb45
commit 88e94650dc5781d842fef548d5d0feb5a7fccb45
Merge: 49bc87e dcc00ec
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Aug 28 04:25:07 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Aug 28 04:25:07 2013 -0400

    Merge topic 'PLATFORM_ID-genex' into next
    
    dcc00ec Genex: Add the PLATFORM_ID expression.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dcc00ece4b297f94974b84783805af9c01b6e681
commit dcc00ece4b297f94974b84783805af9c01b6e681
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Aug 27 10:57:16 2013 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Aug 28 10:23:20 2013 +0200

    Genex: Add the PLATFORM_ID expression.

diff --git a/Source/cmDocumentGeneratorExpressions.h b/Source/cmDocumentGeneratorExpressions.h
index 46cd77e..7bab741 100644
--- a/Source/cmDocumentGeneratorExpressions.h
+++ b/Source/cmDocumentGeneratorExpressions.h
@@ -40,6 +40,9 @@
   "is exported using export(), or when the target is used by another "  \
   "target in the same buildsystem. Expands to the empty string "        \
   "otherwise.\n"                                                        \
+  "  $<PLATFORM_ID>            = The CMake-id of the platform "         \
+  "  $<PLATFORM_ID:comp>       = '1' if the The CMake-id of the "       \
+  "platform matches comp, otherwise '0'.\n"                             \
   "  $<C_COMPILER_ID>          = The CMake-id of the C compiler "       \
   "used.\n"                                                             \
   "  $<C_COMPILER_ID:comp>     = '1' if the CMake-id of the C "         \
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index e0c8c9e..bed9568 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() {}
@@ -1355,6 +1388,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")
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index 4d8d7ed..47e7882 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -186,6 +186,11 @@ add_custom_target(check-part3 ALL
     -Dtest_alias_target_name=$<STREQUAL:$<TARGET_PROPERTY:Alias::SomeLib,NAME>,$<TARGET_PROPERTY:empty1,NAME>>
     -Dtest_early_termination_1=$<$<1:>:
     -Dtest_early_termination_2=$<$<1:>:,
+    -Dsystem_name=${CMAKE_HOST_SYSTEM_NAME}
+    -Dtest_platform_id=$<PLATFORM_ID>
+    -Dtest_platform_id_Linux=$<PLATFORM_ID:Linux>
+    -Dtest_platform_id_Windows=$<PLATFORM_ID:Windows>
+    -Dtest_platform_id_Darwin=$<PLATFORM_ID:Darwin>
     -P ${CMAKE_CURRENT_SOURCE_DIR}/check-part3.cmake
   COMMAND ${CMAKE_COMMAND} -E echo "check done (part 3 of 3)"
   VERBATIM
diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake
index 74a596c..93ea487 100644
--- a/Tests/GeneratorExpression/check-part3.cmake
+++ b/Tests/GeneratorExpression/check-part3.cmake
@@ -26,3 +26,11 @@ check(test_alias_file_lib "1")
 check(test_alias_target_name "1")
 check(test_early_termination_1 "$<:")
 check(test_early_termination_2 "$<:,")
+check(test_platform_id "${system_name}")
+foreach(system Linux Windows Darwin)
+  if(system_name STREQUAL system)
+    check(test_platform_id_${system} 1)
+  else()
+    check(test_platform_id_${system} 0)
+  endif()
+endforeach()

-----------------------------------------------------------------------

Summary of changes:
 Source/cmDocumentGeneratorExpressions.h     |    3 ++
 Source/cmGeneratorExpressionEvaluator.cxx   |   35 +++++++++++++++++++++++++++
 Tests/GeneratorExpression/CMakeLists.txt    |    5 ++++
 Tests/GeneratorExpression/check-part3.cmake |    8 ++++++
 4 files changed, 51 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list