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;
|
scope = cmProperty::TEST;
|
||||||
}
|
}
|
||||||
|
else if (args[1] == "VARIABLE")
|
||||||
|
{
|
||||||
|
scope = cmProperty::VARIABLE;
|
||||||
|
}
|
||||||
|
else if (args[1] == "CACHED_VARIABLE")
|
||||||
|
{
|
||||||
|
scope = cmProperty::CACHED_VARIABLE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->SetError("called with illegal arguments.");
|
this->SetError("called with illegal arguments.");
|
||||||
|
|
|
@ -56,7 +56,8 @@ public:
|
||||||
" short_description\n"
|
" short_description\n"
|
||||||
" full_description chain)\n"
|
" full_description chain)\n"
|
||||||
"Define a property for a scope. The scope_value is either GLOBAL "
|
"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 "
|
"descriptions are used to document the property, chain indicates "
|
||||||
"if that property chains such that a request for the property "
|
"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 "
|
"on a target will chain up to the directory if it is not set on the "
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
class cmProperty
|
class cmProperty
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum ScopeType { TARGET, SOURCE_FILE, DIRECTORY, GLOBAL, TEST };
|
enum ScopeType { TARGET, SOURCE_FILE, DIRECTORY, GLOBAL,
|
||||||
|
TEST, VARIABLE, CACHED_VARIABLE };
|
||||||
|
|
||||||
// set this property
|
// set this property
|
||||||
void Set(const char *name, const char *value);
|
void Set(const char *name, const char *value);
|
||||||
|
|
|
@ -57,6 +57,11 @@ void cmPropertyDefinition
|
||||||
break;
|
break;
|
||||||
case cmProperty::TEST: this->LongName += " on CTest";
|
case cmProperty::TEST: this->LongName += " on CTest";
|
||||||
break;
|
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:
|
case cmProperty::TEST:
|
||||||
msg += "test.";
|
msg += "test.";
|
||||||
break;
|
break;
|
||||||
|
case cmProperty::VARIABLE:
|
||||||
|
msg += "variable.";
|
||||||
|
break;
|
||||||
|
case cmProperty::CACHED_VARIABLE:
|
||||||
|
msg += "cached variable.";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
msg += "unknown.";
|
msg += "unknown.";
|
||||||
break;
|
break;
|
||||||
|
@ -128,6 +134,12 @@ const char *cmPropertyMap
|
||||||
case cmProperty::TEST:
|
case cmProperty::TEST:
|
||||||
msg += "test.";
|
msg += "test.";
|
||||||
break;
|
break;
|
||||||
|
case cmProperty::VARIABLE:
|
||||||
|
msg += "variable.";
|
||||||
|
break;
|
||||||
|
case cmProperty::CACHED_VARIABLE:
|
||||||
|
msg += "cached variable.";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
msg += "unknown.";
|
msg += "unknown.";
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2163,20 +2163,12 @@ void cmake::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v,
|
||||||
void cmake::GetPropertiesDocumentation(std::vector<cmDocumentationEntry>& v)
|
void cmake::GetPropertiesDocumentation(std::vector<cmDocumentationEntry>& v)
|
||||||
{
|
{
|
||||||
// get the properties for cmake
|
// get the properties for cmake
|
||||||
|
std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>::iterator i =
|
||||||
// get them for any generators
|
this->PropertyDefinitions.begin();
|
||||||
|
for (; i != this->PropertyDefinitions.end(); ++i)
|
||||||
// get them for Directories
|
{
|
||||||
this->DirectoryProperties.GetPropertiesDocumentation(v);
|
i->second.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);
|
|
||||||
|
|
||||||
cmDocumentationEntry empty = {0,0,0};
|
cmDocumentationEntry empty = {0,0,0};
|
||||||
v.push_back(empty);
|
v.push_back(empty);
|
||||||
|
@ -2943,67 +2935,18 @@ void cmake::DefineProperty(const char *name, cmProperty::ScopeType scope,
|
||||||
const char *FullDescription,
|
const char *FullDescription,
|
||||||
bool chained)
|
bool chained)
|
||||||
{
|
{
|
||||||
switch (scope)
|
this->PropertyDefinitions[scope].DefineProperty(name,scope,ShortDescription,
|
||||||
{
|
FullDescription, chained);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmake::IsPropertyDefined(const char *name, cmProperty::ScopeType scope)
|
bool cmake::IsPropertyDefined(const char *name, cmProperty::ScopeType scope)
|
||||||
{
|
{
|
||||||
switch (scope)
|
return this->PropertyDefinitions[scope].IsPropertyDefined(name);
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmake::IsPropertyChained(const char *name, cmProperty::ScopeType scope)
|
bool cmake::IsPropertyChained(const char *name, cmProperty::ScopeType scope)
|
||||||
{
|
{
|
||||||
switch (scope)
|
return this->PropertyDefinitions[scope].IsPropertyChained(name);
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmake::SetProperty(const char* prop, const char* value)
|
void cmake::SetProperty(const char* prop, const char* value)
|
||||||
|
|
|
@ -314,11 +314,9 @@ class cmake
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
cmPropertyMap Properties;
|
cmPropertyMap Properties;
|
||||||
cmPropertyDefinitionMap TargetProperties;
|
|
||||||
cmPropertyDefinitionMap SourceFileProperties;
|
std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>
|
||||||
cmPropertyDefinitionMap DirectoryProperties;
|
PropertyDefinitions;
|
||||||
cmPropertyDefinitionMap TestProperties;
|
|
||||||
cmPropertyDefinitionMap GlobalProperties;
|
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)();
|
cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)();
|
||||||
|
|
Loading…
Reference in New Issue