diff options
author | Eric NOULARD <eric.noulard@gmail.com> | 2012-02-04 11:15:57 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2012-02-14 21:05:23 (GMT) |
commit | 02ccb3291bd1053df30600211b0ceefbb7fea00f (patch) | |
tree | 1687be1cb35110d1553548787a82fac5346ecbec /Source/CPack/cpack.cxx | |
parent | 24fbc28e5f81823661853be0c0acdf2670b3453e (diff) | |
download | CMake-02ccb3291bd1053df30600211b0ceefbb7fea00f.zip CMake-02ccb3291bd1053df30600211b0ceefbb7fea00f.tar.gz CMake-02ccb3291bd1053df30600211b0ceefbb7fea00f.tar.bz2 |
Create getDocumentedModulesListInDir which may be used in other context.
This should makes it easier to use the same "documented module"
techniques for CTest, CMake or user module.
Diffstat (limited to 'Source/CPack/cpack.cxx')
-rw-r--r-- | Source/CPack/cpack.cxx | 67 |
1 files changed, 12 insertions, 55 deletions
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 25a72fa..3182915 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -26,7 +26,6 @@ #include "cmCPackLog.h" #include <cmsys/CommandLineArguments.hxx> -#include <cmsys/Glob.hxx> #include <cmsys/SystemTools.hxx> #include <memory> // auto_ptr @@ -527,68 +526,26 @@ int main (int argc, char *argv[]) std::vector<cmDocumentationEntry> commands; - typedef std::pair<std::string,std::string> docModuleSectionPair_t; - typedef std::list<docModuleSectionPair_t> docedModulesList_t; - docedModulesList_t docedModList; - docModuleSectionPair_t docPair; - std::string docedFile; + std::string docedFile; + std::string docPath; + cmDocumentation::documentedModulesList_t docedModList; - cmsys::Glob gl; - std::string findExpr; - std::vector<std::string> files; - std::string line; docedFile = globalMF->GetModulesFile("CPack.cmake"); if (docedFile.length()!=0) { - findExpr += cmSystemTools::GetFilenamePath(docedFile.c_str()); - findExpr += "/CPack*.cmake"; - if (gl.FindFiles(findExpr)) - { - files = gl.GetFiles(); - for (std::vector<std::string>::iterator itf=files.begin(); - itf!=files.end();++itf) - { - std::ifstream fin((*itf).c_str()); - if (!fin) continue; - if (cmSystemTools::GetLineFromStream(fin, line)) - { - if (line.find("##section")!=std::string::npos) - { - docPair.first = cmSystemTools::GetFilenameName(*itf); - // 10 is the size of '##section' + 1 - docPair.second = line.substr(10,std::string::npos); - docedModList.push_back(docPair); - } - } - else - { - line.clear(); - } - } - } - else - { - // build the list of files to be parsed for documentation - // extraction - docPair.first = "CPack.cmake"; - docPair.second = "Variables common to all CPack generators"; - docedModList.push_back(docPair); - docPair.first = "CPackComponent.cmake"; - docedModList.push_back(docPair); - } + docPath = cmSystemTools::GetFilenamePath(docedFile.c_str()); + doc.getDocumentedModulesListInDir(docPath,"CPack*.cmake",docedModList); } // parse the files for documentation. - for (docedModulesList_t::iterator it = docedModList.begin(); - it!= docedModList.end(); ++it) + cmDocumentation::documentedModulesList_t::iterator docedIt; + for (docedIt = docedModList.begin(); + docedIt!= docedModList.end(); ++docedIt) { - docedFile = globalMF->GetModulesFile((it->first).c_str()); - if (docedFile.length()!=0) - { - doc.GetStructuredDocFromFile(docedFile.c_str(), - commands,&cminst,(it->second).c_str()); - } - } + doc.GetStructuredDocFromFile( + (docedIt->first).c_str(), + commands,&cminst,(docedIt->second).c_str()); + } std::map<std::string,cmDocumentationSection *> propDocs; cminst.GetPropertiesDocumentation(propDocs); |