summaryrefslogtreecommitdiffstats
path: root/Source/cmGetPropertyCommand.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2007-10-24 18:43:10 (GMT)
committerKen Martin <ken.martin@kitware.com>2007-10-24 18:43:10 (GMT)
commitf72d666a7bd7a1b58db5f08b5ee9124f6768fa2a (patch)
tree60e30ec34afc9bf475546d35689b4e18144956bd /Source/cmGetPropertyCommand.cxx
parentc2f0aac146f6b990940240891b959dc1f394e80c (diff)
downloadCMake-f72d666a7bd7a1b58db5f08b5ee9124f6768fa2a.zip
CMake-f72d666a7bd7a1b58db5f08b5ee9124f6768fa2a.tar.gz
CMake-f72d666a7bd7a1b58db5f08b5ee9124f6768fa2a.tar.bz2
ENH: add ability to get documentaiton of a property from a script
Diffstat (limited to 'Source/cmGetPropertyCommand.cxx')
-rw-r--r--Source/cmGetPropertyCommand.cxx61
1 files changed, 54 insertions, 7 deletions
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 44ad26e..273cfd6 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -18,6 +18,7 @@
#include "cmake.h"
#include "cmTest.h"
+#include "cmPropertyDefinition.h"
// cmGetPropertyCommand
bool cmGetPropertyCommand::InitialPass(
@@ -31,33 +32,51 @@ bool cmGetPropertyCommand::InitialPass(
// the last argument in the property to get
const char *property = args[args.size()-1].c_str();
+ bool get_brief = false;
+ if (!strcmp(property,"BRIEF_DOCS"))
+ {
+ get_brief = true;
+ property = args[args.size()-2].c_str();
+ }
+ bool get_full = false;
+ if (!strcmp(property,"FULL_DOCS"))
+ {
+ get_full = true;
+ property = args[args.size()-2].c_str();
+ }
+
std::string output = "NOTFOUND";
cmProperty::ScopeType scope;
const char *scopeName = 0;
- if (args[1] == "GLOBAL" && args.size() == 3)
+ if (args[1] == "GLOBAL")
{
scope = cmProperty::GLOBAL;
}
+ else if (args[1] == "VARIABLE")
+ {
+ scope = cmProperty::VARIABLE;
+ }
else if (args[1] == "DIRECTORY" && args.size() >= 3)
{
scope = cmProperty::DIRECTORY;
- if (args.size() >= 4)
+ if ((args.size() == 4 && !get_brief && !get_full) ||
+ (args.size() == 5 && (get_brief || get_full)))
{
scopeName = args[2].c_str();
}
}
- else if (args[1] == "TARGET" && args.size() == 4)
+ else if (args[1] == "TARGET" && args.size() >= 4)
{
scope = cmProperty::TARGET;
scopeName = args[2].c_str();
}
- else if (args[1] == "TEST" && args.size() == 4)
+ else if (args[1] == "TEST" && args.size() >= 4)
{
scope = cmProperty::TEST;
scopeName = args[2].c_str();
}
- else if (args[1] == "SOURCE_FILE" && args.size() == 4)
+ else if (args[1] == "SOURCE_FILE" && args.size() >= 4)
{
scope = cmProperty::SOURCE_FILE;
scopeName = args[2].c_str();
@@ -68,8 +87,37 @@ bool cmGetPropertyCommand::InitialPass(
return false;
}
- switch (scope)
+ if (get_brief)
+ {
+ cmPropertyDefinition *def =
+ this->Makefile->GetCMakeInstance()->
+ GetPropertyDefinition(property,scope);
+ if (def)
+ {
+ output = def->GetShortDescription();
+ }
+ }
+ else if (get_full)
{
+ cmPropertyDefinition *def =
+ this->Makefile->GetCMakeInstance()->
+ GetPropertyDefinition(property,scope);
+ if (def)
+ {
+ output = def->GetFullDescription();
+ }
+ }
+
+ else switch (scope)
+ {
+ case cmProperty::VARIABLE:
+ {
+ if (this->Makefile->GetDefinition(property))
+ {
+ output = this->Makefile->GetDefinition(property);
+ }
+ }
+ break;
case cmProperty::TARGET:
{
cmTarget *tgt = this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
@@ -152,7 +200,6 @@ bool cmGetPropertyCommand::InitialPass(
}
}
break;
- case cmProperty::VARIABLE:
case cmProperty::CACHED_VARIABLE:
// not handled by GetProperty
break;