[Cmake-commits] CMake branch, next, updated. v2.8.7-2901-gcf6c0f1

Brad King brad.king at kitware.com
Mon Feb 27 08:53:42 EST 2012


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  cf6c0f190486cfa5a7b3b1fa13e7ad8a67fa2ce8 (commit)
       via  35de3288e728341c9d97848fbf2414b2943eea0f (commit)
       via  3417205d236983cf8237c3447f9f078c3adf5b0c (commit)
      from  e7dd27e61cc9936a41141da90af5172315273497 (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=cf6c0f190486cfa5a7b3b1fa13e7ad8a67fa2ce8
commit cf6c0f190486cfa5a7b3b1fa13e7ad8a67fa2ce8
Merge: e7dd27e 35de328
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Feb 27 08:53:38 2012 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Feb 27 08:53:38 2012 -0500

    Merge topic 'simplify-PropertyMap' into next
    
    35de328 Revert "Drop cmProperty class"
    3417205 Revert "Remove cmProperty.{h,cxx}"


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=35de3288e728341c9d97848fbf2414b2943eea0f
commit 35de3288e728341c9d97848fbf2414b2943eea0f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Feb 27 08:52:07 2012 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Feb 27 08:53:16 2012 -0500

    Revert "Drop cmProperty class"
    
    This reverts commit a592c45165356dae467fefeec97ee1df7cf70805.

diff --git a/Source/cmProperty.cxx b/Source/cmProperty.cxx
index e69de29..3b37cf3 100644
--- a/Source/cmProperty.cxx
+++ b/Source/cmProperty.cxx
@@ -0,0 +1,40 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+#include "cmProperty.h"
+#include "cmSystemTools.h"
+
+void cmProperty::Set(const char *name, const char *value)
+{
+  this->Name = name;
+  this->Value = value;
+  this->ValueHasBeenSet = true;
+}
+
+void cmProperty::Append(const char *name, const char *value, bool asString)
+{
+  this->Name = name;
+  if(!this->Value.empty() && *value && !asString)
+    {
+    this->Value += ";";
+    }
+  this->Value += value;
+  this->ValueHasBeenSet = true;
+}
+
+const char *cmProperty::GetValue() const
+{
+  if (this->ValueHasBeenSet)
+    {
+    return this->Value.c_str();
+    }
+  return 0;
+}
diff --git a/Source/cmProperty.h b/Source/cmProperty.h
index a2b3219..bb75bb0 100644
--- a/Source/cmProperty.h
+++ b/Source/cmProperty.h
@@ -12,10 +12,30 @@
 #ifndef cmProperty_h
 #define cmProperty_h
 
-namespace cmProperty
+#include "cmStandardIncludes.h"
+
+class cmProperty
 {
+public:
   enum ScopeType { TARGET, SOURCE_FILE, DIRECTORY, GLOBAL, CACHE,
                    TEST, VARIABLE, CACHED_VARIABLE };
-}
+
+  // set this property
+  void Set(const char *name, const char *value);
+
+  // append to this property
+  void Append(const char *name, const char *value, bool asString = false);
+
+  // get the value
+  const char *GetValue() const;
+
+  // construct with the value not set
+  cmProperty() { this->ValueHasBeenSet = false; };
+
+protected:
+  std::string Name;
+  std::string Value;
+  bool ValueHasBeenSet;
+};
 
 #endif
diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h
index 898e13b..f68db87 100644
--- a/Source/cmPropertyDefinition.h
+++ b/Source/cmPropertyDefinition.h
@@ -13,7 +13,6 @@
 #define cmPropertyDefinition_h
 
 #include "cmProperty.h"
-#include "cmStandardIncludes.h"
 
 class cmPropertyDefinition 
 {
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index 74bbec6..a4d0bf3 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -13,6 +13,21 @@
 #include "cmSystemTools.h"
 #include "cmake.h"
 
+cmProperty *cmPropertyMap::GetOrCreateProperty(const char *name)
+{
+  cmPropertyMap::iterator it = this->find(name);
+  cmProperty *prop;
+  if (it == this->end())
+    {
+    prop = &(*this)[name];
+    }
+  else
+    {
+    prop = &(it->second);
+    }
+  return prop;
+}
+
 void cmPropertyMap::SetProperty(const char *name, const char *value,
                                 cmProperty::ScopeType scope)
 {
@@ -39,7 +54,8 @@ void cmPropertyMap::SetProperty(const char *name, const char *value,
   (void)scope;
 #endif
 
-  (*this)[name] = value;
+  cmProperty *prop = this->GetOrCreateProperty(name);
+  prop->Set(name,value);
 }
 
 void cmPropertyMap::AppendProperty(const char* name, const char* value,
@@ -64,12 +80,8 @@ void cmPropertyMap::AppendProperty(const char* name, const char* value,
   (void)scope;
 #endif
 
-  cmStdString &old = (*this)[name];
-  if(!old.empty() && !asString)
-    {
-    old += ";";
-    }
-  old += value;
+  cmProperty *prop = this->GetOrCreateProperty(name);
+  prop->Append(name,value,asString);
 }
 
 const char *cmPropertyMap
@@ -106,6 +118,6 @@ const char *cmPropertyMap
       }
     return 0;
     }
-  return it->second.c_str();
+  return it->second.GetValue();
 }
 
diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h
index add5aad..94275e2 100644
--- a/Source/cmPropertyMap.h
+++ b/Source/cmPropertyMap.h
@@ -13,13 +13,14 @@
 #define cmPropertyMap_h
 
 #include "cmProperty.h"
-#include "cmStandardIncludes.h"
 
 class cmake;
 
-class cmPropertyMap : public std::map<cmStdString,cmStdString>
+class cmPropertyMap : public std::map<cmStdString,cmProperty>
 {
 public:
+  cmProperty *GetOrCreateProperty(const char *name);
+
   void SetProperty(const char *name, const char *value, 
                    cmProperty::ScopeType scope);
 
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 45e3cd2..e0892b2 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -57,7 +57,7 @@ void cmTestGenerator::GenerateScriptConfigs(std::ostream& os,
       for ( pit = mpit->begin(); pit != mpit->end(); ++ pit )
         {
         fout << " " << pit->first
-             << " " << lg->EscapeForCMake(pit->second.c_str());
+             << " " << lg->EscapeForCMake(pit->second.GetValue());
         }
       fout << ")" << std::endl;
       }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3417205d236983cf8237c3447f9f078c3adf5b0c
commit 3417205d236983cf8237c3447f9f078c3adf5b0c
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Feb 27 08:51:56 2012 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Feb 27 08:52:41 2012 -0500

    Revert "Remove cmProperty.{h,cxx}"
    
    This reverts commit c89c879ea76e5f0cc296d5e381bf55919c334c12.

diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index e8404ff..0c420b9 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -225,6 +225,8 @@ SET(SRCS
   cmPolicies.cxx
   cmProcessTools.cxx
   cmProcessTools.h
+  cmProperty.cxx
+  cmProperty.h
   cmPropertyDefinition.cxx
   cmPropertyDefinition.h
   cmPropertyDefinitionMap.cxx
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index 0bf3669..11bef16 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -13,7 +13,7 @@
 #define _cmDocumentation_h
 
 #include "cmStandardIncludes.h"
-#include "cmPropertyMap.h"
+#include "cmProperty.h"
 #include "cmDocumentationFormatter.h"
 #include "cmDocumentationFormatterHTML.h"
 #include "cmDocumentationFormatterDocbook.h"
diff --git a/Source/cmProperty.cxx b/Source/cmProperty.cxx
new file mode 100644
index 0000000..e69de29
diff --git a/Source/cmProperty.h b/Source/cmProperty.h
new file mode 100644
index 0000000..a2b3219
--- /dev/null
+++ b/Source/cmProperty.h
@@ -0,0 +1,21 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+#ifndef cmProperty_h
+#define cmProperty_h
+
+namespace cmProperty
+{
+  enum ScopeType { TARGET, SOURCE_FILE, DIRECTORY, GLOBAL, CACHE,
+                   TEST, VARIABLE, CACHED_VARIABLE };
+}
+
+#endif
diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h
index e1c2648..898e13b 100644
--- a/Source/cmPropertyDefinition.h
+++ b/Source/cmPropertyDefinition.h
@@ -12,7 +12,7 @@
 #ifndef cmPropertyDefinition_h
 #define cmPropertyDefinition_h
 
-#include "cmPropertyMap.h"
+#include "cmProperty.h"
 #include "cmStandardIncludes.h"
 
 class cmPropertyDefinition 
diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h
index 9759a27..add5aad 100644
--- a/Source/cmPropertyMap.h
+++ b/Source/cmPropertyMap.h
@@ -12,16 +12,11 @@
 #ifndef cmPropertyMap_h
 #define cmPropertyMap_h
 
+#include "cmProperty.h"
 #include "cmStandardIncludes.h"
 
 class cmake;
 
-namespace cmProperty
-{
-  enum ScopeType { TARGET, SOURCE_FILE, DIRECTORY, GLOBAL, CACHE,
-                   TEST, VARIABLE, CACHED_VARIABLE };
-}
-
 class cmPropertyMap : public std::map<cmStdString,cmStdString>
 {
 public:
diff --git a/bootstrap b/bootstrap
index 327f6c8..f5eacbd 100755
--- a/bootstrap
+++ b/bootstrap
@@ -188,6 +188,7 @@ CMAKE_CXX_SOURCES="\
   cmDocumentationFormatter \
   cmDocumentationFormatterText \
   cmPolicies \
+  cmProperty \
   cmPropertyMap \
   cmPropertyDefinition \
   cmPropertyDefinitionMap \

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

Summary of changes:
 Source/CMakeLists.txt                              |    2 +
 Source/cmDocumentation.h                           |    2 +-
 ...{cmAddDefinitionsCommand.cxx => cmProperty.cxx} |   33 ++++++++++------
 Source/{cmVersion.h => cmProperty.h}               |   42 ++++++++++---------
 Source/cmPropertyDefinition.h                      |    3 +-
 Source/cmPropertyMap.cxx                           |   28 +++++++++----
 Source/cmPropertyMap.h                             |   12 ++----
 Source/cmTestGenerator.cxx                         |    2 +-
 bootstrap                                          |    1 +
 9 files changed, 73 insertions(+), 52 deletions(-)
 copy Source/{cmAddDefinitionsCommand.cxx => cmProperty.cxx} (52%)
 copy Source/{cmVersion.h => cmProperty.h} (52%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list