summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmDefinePropertyCommand.cxx8
-rw-r--r--Source/cmDefinePropertyCommand.h3
-rw-r--r--Source/cmProperty.h3
-rw-r--r--Source/cmPropertyDefinition.cxx5
-rw-r--r--Source/cmPropertyMap.cxx12
-rw-r--r--Source/cmake.cxx77
-rw-r--r--Source/cmake.h8
7 files changed, 42 insertions, 74 deletions
diff --git a/Source/cmDefinePropertyCommand.cxx b/Source/cmDefinePropertyCommand.cxx
index 15a8cf5..f0bd7d8 100644
--- a/Source/cmDefinePropertyCommand.cxx
+++ b/Source/cmDefinePropertyCommand.cxx
@@ -49,6 +49,14 @@ bool cmDefinePropertyCommand::InitialPass(
{
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.");
diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h
index 125296f..95aa0ab 100644
--- a/Source/cmDefinePropertyCommand.h
+++ b/Source/cmDefinePropertyCommand.h
@@ -56,7 +56,8 @@ public:
" 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 "
diff --git a/Source/cmProperty.h b/Source/cmProperty.h
index 451bb94..fc8e277 100644
--- a/Source/cmProperty.h
+++ b/Source/cmProperty.h
@@ -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);
diff --git a/Source/cmPropertyDefinition.cxx b/Source/cmPropertyDefinition.cxx
index 9091f34..4a0a0bc 100644
--- a/Source/cmPropertyDefinition.cxx
+++ b/Source/cmPropertyDefinition.cxx
@@ -57,6 +57,11 @@ void cmPropertyDefinition
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;
}
}
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index ed2976b..c69ca7b 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -75,6 +75,12 @@ void cmPropertyMap::SetProperty(const char *name, const char *value,
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 @@ const char *cmPropertyMap
case cmProperty::TEST:
msg += "test.";
break;
+ case cmProperty::VARIABLE:
+ msg += "variable.";
+ break;
+ case cmProperty::CACHED_VARIABLE:
+ msg += "cached variable.";
+ break;
default:
msg += "unknown.";
break;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index f1d539f..bbd0fb2 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2163,20 +2163,12 @@ void cmake::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v,
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 @@ void cmake::DefineProperty(const char *name, cmProperty::ScopeType scope,
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)
diff --git a/Source/cmake.h b/Source/cmake.h
index 1abb1e8..8f6b283 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -314,11 +314,9 @@ class cmake
protected:
cmPropertyMap Properties;
- cmPropertyDefinitionMap TargetProperties;
- cmPropertyDefinitionMap SourceFileProperties;
- cmPropertyDefinitionMap DirectoryProperties;
- cmPropertyDefinitionMap TestProperties;
- cmPropertyDefinitionMap GlobalProperties;
+
+ std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>
+ PropertyDefinitions;
typedef
cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)();