diff options
author | David Cole <david.cole@kitware.com> | 2012-02-21 20:57:17 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2012-02-21 20:57:17 (GMT) |
commit | 7d02020d682018a541b10460b28d6a8d0ef9bcf3 (patch) | |
tree | 6face441e39633627979846bbb00cdb39ffe8c67 /Source | |
parent | 6c6c2664394d9542cf611b7941c0f45cffd1e108 (diff) | |
parent | 9a8103e929de7569fd2e5459a6676dff64d88892 (diff) | |
download | CMake-7d02020d682018a541b10460b28d6a8d0ef9bcf3.zip CMake-7d02020d682018a541b10460b28d6a8d0ef9bcf3.tar.gz CMake-7d02020d682018a541b10460b28d6a8d0ef9bcf3.tar.bz2 |
Merge topic 'CPack-dynamicDocSection'
9a8103e Try to fix compile error on Win32-vs70
4da2223 Fix typo in end markup
cfac874 More documentation concerning CPack Components
dee0a38 Put CPack DMG and PackageMaker doc in separate files
b4abcfe Correct copy/paste section name mistake
9717727 Suppress unecessary (now empty) doc sections
7a8f44a Add structure documentation for CPack Bundle generator
b8a274c Add structured documentation for NSIS
a6bce55 Dynamically add documentation section specified in documented script.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CPack/cpack.cxx | 3 | ||||
-rw-r--r-- | Source/cmDocumentation.cxx | 24 | ||||
-rw-r--r-- | Source/cmDocumentation.h | 6 |
3 files changed, 24 insertions, 9 deletions
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index c541610..6f5055c 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -514,7 +514,6 @@ int main (int argc, char *argv[]) if ( help ) { // Construct and print requested documentation. - std::vector<cmDocumentationEntry> variables; doc.SetName("cpack"); doc.SetSection("Name",cmDocumentationName); @@ -545,7 +544,7 @@ int main (int argc, char *argv[]) { doc.GetStructuredDocFromFile( (docedIt->first).c_str(), - commands,&cminst,(docedIt->second).c_str()); + commands,&cminst); } std::map<std::string,cmDocumentationSection *> propDocs; diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 02f69f1..904a157 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -16,6 +16,7 @@ #include <cmsys/Directory.hxx> #include <cmsys/Glob.hxx> +#include <algorithm> //---------------------------------------------------------------------------- static const char *cmDocumentationStandardOptions[][3] = @@ -741,10 +742,20 @@ void cmDocumentation::addCPackStandardDocSections() this->VariableSections.push_back( "Variables common to all CPack generators"); - this->VariableSections.push_back( - "Variables specific to a CPack generator"); } +void cmDocumentation::addAutomaticVariableSections(const std::string& section) +{ + std::vector<std::string>::iterator it; + it = std::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 +829,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 +845,7 @@ int cmDocumentation::GetStructuredDocFromFile( { return nbDocItemFound; } + std::string section; std::string name; std::string full; std::string brief; @@ -886,6 +897,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 +913,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 */ diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 00dba1a..11bef16 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -147,6 +147,9 @@ public: /** Add the CPack standard documentation section(s) */ void addCPackStandardDocSections(); + /** Add automatic variables sections */ + void addAutomaticVariableSections(const std::string& section); + /** * Retrieve the list of documented module located in * path which match the globing expression globExpr. @@ -185,8 +188,7 @@ public: */ int GetStructuredDocFromFile(const char* fname, std::vector<cmDocumentationEntry>& commands, - cmake* cm, - const char *docSection); + cmake* cm); private: void SetForm(Form f); void SetDocName(const char* docname); |