[cmake-commits] martink committed cmDefinePropertyCommand.cxx 1.1 1.2 cmDefinePropertyCommand.h 1.1 1.2 cmProperty.h 1.1 1.2 cmPropertyDefinition.cxx 1.3 1.4 cmPropertyMap.cxx 1.7 1.8 cmake.cxx 1.302 1.303 cmake.h 1.83 1.84

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Jun 25 10:34:23 EDT 2007


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv417

Modified Files:
	cmDefinePropertyCommand.cxx cmDefinePropertyCommand.h 
	cmProperty.h cmPropertyDefinition.cxx cmPropertyMap.cxx 
	cmake.cxx cmake.h 
Log Message:
ENH: added the ability to document variables and cached_variables


Index: cmPropertyDefinition.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmPropertyDefinition.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cmPropertyDefinition.cxx	5 Dec 2006 15:38:36 -0000	1.3
+++ cmPropertyDefinition.cxx	25 Jun 2007 14:34:21 -0000	1.4
@@ -57,6 +57,11 @@
       break;
     case cmProperty::TEST: this->LongName += " on CTest";
       break;
+    case cmProperty::VARIABLE: this->LongName += " as a variable";
+      break;
+    case cmProperty::CACHED_VARIABLE: this->LongName += 
+                                        " as a cached variable";
+      break;
     }
 }
 

Index: cmake.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.h,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- cmake.h	22 Jun 2007 12:44:51 -0000	1.83
+++ cmake.h	25 Jun 2007 14:34:21 -0000	1.84
@@ -314,11 +314,9 @@
 
 protected:
   cmPropertyMap Properties;
-  cmPropertyDefinitionMap TargetProperties;
-  cmPropertyDefinitionMap SourceFileProperties;
-  cmPropertyDefinitionMap DirectoryProperties;
-  cmPropertyDefinitionMap TestProperties;
-  cmPropertyDefinitionMap GlobalProperties;
+
+  std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> 
+  PropertyDefinitions;
 
   typedef 
      cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)();

Index: cmDefinePropertyCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDefinePropertyCommand.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cmDefinePropertyCommand.cxx	7 Dec 2006 14:45:32 -0000	1.1
+++ cmDefinePropertyCommand.cxx	25 Jun 2007 14:34:21 -0000	1.2
@@ -49,6 +49,14 @@
     {
     scope = cmProperty::TEST;
     }
+  else if (args[1] == "VARIABLE")
+    {
+    scope = cmProperty::VARIABLE;
+    }
+  else if (args[1] == "CACHED_VARIABLE")
+    {
+    scope = cmProperty::CACHED_VARIABLE;
+    }
   else
     {
     this->SetError("called with illegal arguments.");

Index: cmProperty.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmProperty.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cmProperty.h	1 Dec 2006 18:35:03 -0000	1.1
+++ cmProperty.h	25 Jun 2007 14:34:21 -0000	1.2
@@ -22,7 +22,8 @@
 class cmProperty 
 {
 public:
-  enum ScopeType { TARGET, SOURCE_FILE, DIRECTORY, GLOBAL, TEST };
+  enum ScopeType { TARGET, SOURCE_FILE, DIRECTORY, GLOBAL, 
+                   TEST, VARIABLE, CACHED_VARIABLE };
 
   // set this property
   void Set(const char *name, const char *value);

Index: cmake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.cxx,v
retrieving revision 1.302
retrieving revision 1.303
diff -u -d -r1.302 -r1.303
--- cmake.cxx	25 Jun 2007 13:51:37 -0000	1.302
+++ cmake.cxx	25 Jun 2007 14:34:21 -0000	1.303
@@ -2163,20 +2163,12 @@
 void cmake::GetPropertiesDocumentation(std::vector<cmDocumentationEntry>& v)
 {
   // get the properties for cmake
-  
-  // get them for any generators
-
-  // get them for Directories
-  this->DirectoryProperties.GetPropertiesDocumentation(v);
-
-  // get them for targets
-  this->TargetProperties.GetPropertiesDocumentation(v);
-  
-  // get them for source files
-  this->SourceFileProperties.GetPropertiesDocumentation(v);
-  
-  // get them for tests
-  this->TestProperties.GetPropertiesDocumentation(v);
+  std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>::iterator i = 
+    this->PropertyDefinitions.begin();
+  for (; i != this->PropertyDefinitions.end(); ++i)
+    {
+    i->second.GetPropertiesDocumentation(v);
+    }
 
   cmDocumentationEntry empty = {0,0,0};
   v.push_back(empty);
@@ -2943,67 +2935,18 @@
                            const char *FullDescription,
                            bool chained)
 {
-  switch (scope)
-    {
-    case cmProperty::GLOBAL:
-      this->GlobalProperties.DefineProperty(name,scope,ShortDescription,
-                                            FullDescription, chained);
-      break;
-    case cmProperty::TARGET:
-      this->TargetProperties.DefineProperty(name,scope,ShortDescription,
-                                            FullDescription, chained);
-      break;
-    case cmProperty::SOURCE_FILE:
-      this->SourceFileProperties.DefineProperty(name,scope,ShortDescription,
-                                                FullDescription, chained);
-      break;
-    case cmProperty::DIRECTORY:
-      this->DirectoryProperties.DefineProperty(name,scope,ShortDescription,
-                                               FullDescription, chained);
-      break;
-    case cmProperty::TEST:
-      this->TestProperties.DefineProperty(name,scope,ShortDescription,
-                                          FullDescription, chained);
-      break;
-    }
+  this->PropertyDefinitions[scope].DefineProperty(name,scope,ShortDescription,
+                                                  FullDescription, chained);
 }
 
 bool cmake::IsPropertyDefined(const char *name, cmProperty::ScopeType scope)
 {
-  switch (scope)
-    {
-    case cmProperty::GLOBAL:
-      return this->GlobalProperties.IsPropertyDefined(name);
-    case cmProperty::TARGET:
-      return this->TargetProperties.IsPropertyDefined(name);
-    case cmProperty::SOURCE_FILE:
-      return this->SourceFileProperties.IsPropertyDefined(name);
-    case cmProperty::DIRECTORY:
-      return this->DirectoryProperties.IsPropertyDefined(name);
-    case cmProperty::TEST:
-      return this->TestProperties.IsPropertyDefined(name);
-    }
-
-  return false;
+  return this->PropertyDefinitions[scope].IsPropertyDefined(name);
 }
 
 bool cmake::IsPropertyChained(const char *name, cmProperty::ScopeType scope)
 {
-  switch (scope)
-    {
-    case cmProperty::GLOBAL:
-      return this->GlobalProperties.IsPropertyChained(name);
-    case cmProperty::TARGET:
-      return this->TargetProperties.IsPropertyChained(name);
-    case cmProperty::SOURCE_FILE:
-      return this->SourceFileProperties.IsPropertyChained(name);
-    case cmProperty::DIRECTORY:
-      return this->DirectoryProperties.IsPropertyChained(name);
-    case cmProperty::TEST:
-      return this->DirectoryProperties.IsPropertyChained(name);
-  }
-
-  return false;
+  return this->PropertyDefinitions[scope].IsPropertyChained(name);
 }
 
 void cmake::SetProperty(const char* prop, const char* value)

Index: cmDefinePropertyCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDefinePropertyCommand.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cmDefinePropertyCommand.h	7 Dec 2006 14:45:32 -0000	1.1
+++ cmDefinePropertyCommand.h	25 Jun 2007 14:34:21 -0000	1.2
@@ -56,7 +56,8 @@
         "                  short_description\n"
         "                  full_description chain)\n"
         "Define a property for a scope. The scope_value is either GLOBAL "
-        "DIRECTORY, TARGET, TEST, SOURCE_FILE. The short and full "
+        "DIRECTORY, TARGET, TEST, SOURCE_FILE, VARIABLE, CACHED_VARIABLE. "
+        "The short and full "
         "descriptions are used to document the property, chain indicates "
         "if that property chains such that a request for the property "
         "on a target will chain up to the directory if it is not set on the "

Index: cmPropertyMap.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmPropertyMap.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- cmPropertyMap.cxx	13 Mar 2007 18:23:08 -0000	1.7
+++ cmPropertyMap.cxx	25 Jun 2007 14:34:21 -0000	1.8
@@ -75,6 +75,12 @@
       case cmProperty::TEST:
         msg += "test.";
         break;
+      case cmProperty::VARIABLE:
+        msg += "variable.";
+        break;
+      case cmProperty::CACHED_VARIABLE:
+        msg += "cached variable.";
+        break;
       default:
         msg += "unknown.";
         break;
@@ -128,6 +134,12 @@
       case cmProperty::TEST:
         msg += "test.";
         break;
+      case cmProperty::VARIABLE:
+        msg += "variable.";
+        break;
+      case cmProperty::CACHED_VARIABLE:
+        msg += "cached variable.";
+        break;
       default:
         msg += "unknown.";
         break;



More information about the Cmake-commits mailing list