summaryrefslogtreecommitdiffstats
path: root/Source/CPack
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CPack')
-rw-r--r--Source/CPack/cpack.cxx67
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);