summaryrefslogtreecommitdiffstats
path: root/Source/cmDocumentation.cxx
diff options
context:
space:
mode:
authorEric NOULARD <eric.noulard@gmail.com>2012-02-18 21:07:39 (GMT)
committerEric NOULARD <eric.noulard@gmail.com>2012-02-18 21:07:39 (GMT)
commita6bce55aefd332f148a2753d5be0ec4383534473 (patch)
tree6f1af3b2fdb4778edf82859cf0888f637c1e9a40 /Source/cmDocumentation.cxx
parentbfbb57508603ab6c7007d75718b21868b690e151 (diff)
downloadCMake-a6bce55aefd332f148a2753d5be0ec4383534473.zip
CMake-a6bce55aefd332f148a2753d5be0ec4383534473.tar.gz
CMake-a6bce55aefd332f148a2753d5be0ec4383534473.tar.bz2
Dynamically add documentation section specified in documented script.
Modify CPackDeb and CPackRPM as an example
Diffstat (limited to 'Source/cmDocumentation.cxx')
-rw-r--r--Source/cmDocumentation.cxx21
1 files changed, 18 insertions, 3 deletions
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 02f69f1..17e35d8 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -745,6 +745,18 @@ void cmDocumentation::addCPackStandardDocSections()
"Variables specific to a CPack generator");
}
+void cmDocumentation::addAutomaticVariableSections(const std::string& section)
+{
+ std::vector<std::string>::iterator it;
+ it = find(this->VariableSections.begin(),
+ this->VariableSections.end(),
+ section);
+ /* if the section does not exist then add it */
+ if (it==this->VariableSections.end())
+ {
+ this->VariableSections.push_back(section);
+ }
+}
//----------------------------------------------------------------------------
int cmDocumentation::getDocumentedModulesListInDir(
std::string path,
@@ -818,8 +830,7 @@ static void trim(std::string& s)
int cmDocumentation::GetStructuredDocFromFile(
const char* fname,
std::vector<cmDocumentationEntry>& commands,
- cmake* cm,
- const char *docSection)
+ cmake* cm)
{
typedef enum sdoce {
SDOC_NONE, SDOC_MODULE, SDOC_MACRO, SDOC_FUNCTION, SDOC_VARIABLE,
@@ -835,6 +846,7 @@ int cmDocumentation::GetStructuredDocFromFile(
{
return nbDocItemFound;
}
+ std::string section;
std::string name;
std::string full;
std::string brief;
@@ -886,6 +898,8 @@ int cmDocumentation::GetStructuredDocFromFile(
{
docCtxIdx++;
docContextStack[docCtxIdx]=SDOC_SECTION;
+ // 10 is the size of '##section' + 1
+ section = line.substr(10,std::string::npos);
/* drop the rest of the line */
line = "";
newCtx = true;
@@ -900,11 +914,12 @@ int cmDocumentation::GetStructuredDocFromFile(
brief.c_str(),full.c_str()));
break;
case SDOC_VARIABLE:
+ this->addAutomaticVariableSections(section);
cm->DefineProperty
(name.c_str(), cmProperty::VARIABLE,
brief.c_str(),
full.c_str(),false,
- docSection);
+ section.c_str());
break;
case SDOC_MODULE:
/* not implemented */