diff options
author | Eric NOULARD <eric.noulard@gmail.com> | 2011-11-15 19:24:38 (GMT) |
---|---|---|
committer | Eric NOULARD <eric.noulard@gmail.com> | 2012-01-22 10:44:05 (GMT) |
commit | 83e34dd9e688b4721c70c56e66629bdc2768fa77 (patch) | |
tree | bae87f4bb777b7c9e73d77628f52da25add82b4c /Source/CPack/cpack.cxx | |
parent | c6a016944211b737c45385423fc7df10462e34ab (diff) | |
download | CMake-83e34dd9e688b4721c70c56e66629bdc2768fa77.zip CMake-83e34dd9e688b4721c70c56e66629bdc2768fa77.tar.gz CMake-83e34dd9e688b4721c70c56e66629bdc2768fa77.tar.bz2 |
Implement simple CMake script comment markup language.
The language is very simple. It use ##<keyword> special comment
which opens a structured documentation block and ##end closes it.
This may be used to extract documentation for macro as 'command'
and 'variables' such that cpack --help-command and --help-variable
does parse builtin modules files (CPack.cmake, CPackComponent.cmake,
...) in order to extract the corresponding doc.
Diffstat (limited to 'Source/CPack/cpack.cxx')
-rw-r--r-- | Source/CPack/cpack.cxx | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 2cfbf12..8e59fa0 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -520,11 +520,41 @@ int main (int argc, char *argv[]) doc.PrependSection("Options",cmDocumentationOptions); cmCPackDocumentVariables::DefineVariables(&cminst); + + std::vector<cmDocumentationEntry> commands; + + cminst.AddCMakePaths(); + std::string systemFile = + globalMF->GetModulesFile("CMakeDetermineSystem.cmake"); + if (!globalMF->ReadListFile(0, systemFile.c_str())) + { + cmCPack_Log(&log, cmCPackLog::LOG_ERROR, + "Error reading CMakeDetermineSystem.cmake" << std::endl); + return 1; + } + + systemFile = + globalMF->GetModulesFile("CMakeSystemSpecificInformation.cmake"); + if (!globalMF->ReadListFile(0, systemFile.c_str())) + { + cmCPack_Log(&log, cmCPackLog::LOG_ERROR, + "Error reading CMakeSystemSpecificInformation.cmake" + << std::endl); + return 1; + } + std::string cpFile = globalMF->GetModulesFile("CPack.cmake"); + doc.getStructuredDocFromFile(cpFile.c_str(), + commands,&cminst,"Variables common to all CPack generators"); + cpFile = globalMF->GetModulesFile("CPackComponent.cmake"); + doc.getStructuredDocFromFile(cpFile.c_str(), + commands,&cminst,"Variables common to all CPack generators"); + cpFile = globalMF->GetModulesFile("CPackRPM.cmake"); + doc.getStructuredDocFromFile(cpFile.c_str(), + commands,&cminst,"Variables specific to a CPack generator"); + std::map<std::string,cmDocumentationSection *> propDocs; cminst.GetPropertiesDocumentation(propDocs); doc.SetSections(propDocs); - - std::vector<cmDocumentationEntry> commands; cminst.GetCommandDocumentation(commands); cmCPackDocumentMacros::GetMacrosDocumentation(commands); doc.SetSection("Commands",commands); |