ENH: added the ability to document variables and cached_variables
This commit is contained in:
parent
e35da01feb
commit
0b9644910d
|
@ -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.");
|
||||
|
|
|
@ -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 "
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
this->PropertyDefinitions[scope].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;
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
|
|
@ -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)();
|
||||
|
|
Loading…
Reference in New Issue