diff options
-rw-r--r-- | Source/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Source/CPack/cmCPackDocumentMacros.cxx | 16 | ||||
-rw-r--r-- | Source/CPack/cmCPackDocumentMacros.h | 21 | ||||
-rw-r--r-- | Source/CPack/cpack.cxx | 36 | ||||
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.h | 1 | ||||
-rw-r--r-- | Source/CursesDialog/ccmake.cxx | 28 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetup.cxx | 22 | ||||
-rw-r--r-- | Source/cmDocumentation.cxx | 1009 | ||||
-rw-r--r-- | Source/cmDocumentation.h | 69 | ||||
-rw-r--r-- | Source/cmDocumentationFormatter.h | 4 | ||||
-rw-r--r-- | Source/cmPolicies.cxx | 46 | ||||
-rw-r--r-- | Source/cmPolicies.h | 3 | ||||
-rw-r--r-- | Source/cmPropertyDefinitionMap.cxx | 57 | ||||
-rw-r--r-- | Source/cmPropertyDefinitionMap.h | 3 | ||||
-rw-r--r-- | Source/cmake.cxx | 39 | ||||
-rw-r--r-- | Source/cmake.h | 22 | ||||
-rw-r--r-- | Source/cmakemain.cxx | 79 | ||||
-rw-r--r-- | Source/ctest.cxx | 23 |
19 files changed, 23 insertions, 1462 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 5178c0a..3ec0e47 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -499,7 +499,6 @@ set(CPACK_SRCS CPack/cmCPackTarCompressGenerator.cxx CPack/cmCPackZIPGenerator.cxx CPack/cmCPackDocumentVariables.cxx - CPack/cmCPackDocumentMacros.cxx ) if(CYGWIN) diff --git a/Source/CPack/cmCPackDocumentMacros.cxx b/Source/CPack/cmCPackDocumentMacros.cxx deleted file mode 100644 index ddc75a4..0000000 --- a/Source/CPack/cmCPackDocumentMacros.cxx +++ /dev/null @@ -1,16 +0,0 @@ -#include "cmCPackDocumentMacros.h" - -void cmCPackDocumentMacros::GetMacrosDocumentation( - std::vector<cmDocumentationEntry>& ) -{ - // Commented-out example of use - // - // cmDocumentationEntry e("cpack_<macro>", - // "Brief Description" - // "which may be on several lines.", - // "Long description in pre-formatted format" - // " blah\n" - // " blah\n" - //); - //v.push_back(e); -} diff --git a/Source/CPack/cmCPackDocumentMacros.h b/Source/CPack/cmCPackDocumentMacros.h deleted file mode 100644 index 544f74f..0000000 --- a/Source/CPack/cmCPackDocumentMacros.h +++ /dev/null @@ -1,21 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef cmCPackDocumentMacros_h -#define cmCPackDocumentMacros_h -#include "cmStandardIncludes.h" -class cmCPackDocumentMacros -{ -public: - static void GetMacrosDocumentation(std::vector<cmDocumentationEntry>& v); -}; - -#endif diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 7d6a279..0a6d8b9 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -15,7 +15,6 @@ #include "cmake.h" #include "cmDocumentation.h" #include "cmCPackDocumentVariables.h" -#include "cmCPackDocumentMacros.h" #include "cmCPackGeneratorFactory.h" #include "cmCPackGenerator.h" #include "cmake.h" @@ -46,18 +45,6 @@ static const char * cmDocumentationUsage[][3] = }; //---------------------------------------------------------------------------- -static const char * cmDocumentationDescription[][3] = -{ - {0, - "The \"cpack\" executable is the CMake packaging program. " - "CMake-generated build trees created for projects that use " - "the INSTALL_* commands have packaging support. " - "This program will generate the package.", 0}, - CMAKE_STANDARD_INTRODUCTION, - {0,0,0} -}; - -//---------------------------------------------------------------------------- static const char * cmDocumentationOptions[][3] = { {"-G <generator>", "Use the specified generator to generate package.", @@ -130,14 +117,6 @@ static const char * cmDocumentationOptions[][3] = }; //---------------------------------------------------------------------------- -static const char * cmDocumentationSeeAlso[][3] = -{ - {0, "cmake", 0}, - {0, "ccmake", 0}, - {0, 0, 0} -}; - -//---------------------------------------------------------------------------- int cpackUnknownArgument(const char*, void*) { return 1; @@ -533,22 +512,8 @@ int main (int argc, char *argv[]) doc.SetName("cpack"); doc.SetSection("Name",cmDocumentationName); doc.SetSection("Usage",cmDocumentationUsage); - doc.SetSection("Description",cmDocumentationDescription); doc.PrependSection("Options",cmDocumentationOptions); - // statically (in C++ code) defined variables - cmCPackDocumentVariables::DefineVariables(&cminst); - - std::vector<cmDocumentationEntry> commands; - - std::map<std::string,cmDocumentationSection *> propDocs; - cminst.GetPropertiesDocumentation(propDocs); - doc.SetSections(propDocs); - cminst.GetCommandDocumentation(commands,true,false); - // statically (in C++ code) defined macros/commands - cmCPackDocumentMacros::GetMacrosDocumentation(commands); - doc.SetSection("Commands",commands); - std::vector<cmDocumentationEntry> v; cmCPackGeneratorFactory::DescriptionsMap::const_iterator generatorIt; for( generatorIt = generators.GetGeneratorsList().begin(); @@ -563,7 +528,6 @@ int main (int argc, char *argv[]) } doc.SetSection("Generators",v); - doc.SetSeeAlsoList(cmDocumentationSeeAlso); #undef cout return doc.PrintRequestedDocumentation(std::cout)? 0:1; #define cout no_cout_use_cmCPack_Log diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 8643cb3..64bcd59 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -361,12 +361,6 @@ void cmCTestScriptHandler::CreateCMake() this->AddCTestCommand(new cmCTestUploadCommand); } -void cmCTestScriptHandler::GetCommandDocumentation( - std::vector<cmDocumentationEntry>& v) const -{ - this->CMake->GetCommandDocumentation(v); -} - //---------------------------------------------------------------------- // this sets up some variables for the script to use, creates the required // cmake instance and generators, and then reads in the script diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h index 9d852ca..80d5831 100644 --- a/Source/CTest/cmCTestScriptHandler.h +++ b/Source/CTest/cmCTestScriptHandler.h @@ -110,7 +110,6 @@ public: void Initialize(); void CreateCMake(); - void GetCommandDocumentation(std::vector<cmDocumentationEntry>& v) const; cmake* GetCMake() { return this->CMake;} private: // reads in a script diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index 623d7d3..37d0667 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -40,32 +40,12 @@ static const char * cmDocumentationUsage[][3] = }; //---------------------------------------------------------------------------- -static const char * cmDocumentationDescription[][3] = -{ - {0, - "The \"ccmake\" executable is the CMake curses interface. Project " - "configuration settings may be specified interactively through " - "this GUI. Brief instructions are provided at the bottom of the " - "terminal when the program is running.", 0}, - CMAKE_STANDARD_INTRODUCTION, - {0,0,0} -}; - -//---------------------------------------------------------------------------- static const char * cmDocumentationOptions[][3] = { CMAKE_STANDARD_OPTIONS_TABLE, {0,0,0} }; -//---------------------------------------------------------------------------- -static const char * cmDocumentationSeeAlso[][3] = -{ - {0, "cmake", 0}, - {0, "ctest", 0}, - {0, 0, 0} -}; - cmCursesForm* cmCursesForm::CurrentForm=0; extern "C" @@ -106,21 +86,13 @@ int main(int argc, char** argv) if(doc.CheckOptions(argc, argv)) { cmake hcm; - std::vector<cmDocumentationEntry> commands; - std::vector<cmDocumentationEntry> compatCommands; std::vector<cmDocumentationEntry> generators; - hcm.GetCommandDocumentation(commands, true, false); - hcm.GetCommandDocumentation(compatCommands, false, true); hcm.GetGeneratorDocumentation(generators); doc.SetName("ccmake"); doc.SetSection("Name",cmDocumentationName); doc.SetSection("Usage",cmDocumentationUsage); - doc.SetSection("Description",cmDocumentationDescription); doc.SetSection("Generators",generators); doc.PrependSection("Options",cmDocumentationOptions); - doc.SetSection("Command",commands); - doc.SetSection("Compatibility Commands",compatCommands); - doc.SetSeeAlsoList(cmDocumentationSeeAlso); return doc.PrintRequestedDocumentation(std::cout)? 0:1; } diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 01893f5..36b81ea 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -41,18 +41,6 @@ static const char * cmDocumentationUsage[][3] = }; //---------------------------------------------------------------------------- -static const char * cmDocumentationDescription[][3] = -{ - {0, - "The \"cmake-gui\" executable is the CMake GUI. Project " - "configuration settings may be specified interactively. " - "Brief instructions are provided at the bottom of the " - "window when the program is running.", 0}, - CMAKE_STANDARD_INTRODUCTION, - {0,0,0} -}; - -//---------------------------------------------------------------------------- static const char * cmDocumentationOptions[][3] = { {0,0,0} @@ -76,24 +64,14 @@ int main(int argc, char** argv) { doc.SetCMakeRoot(root); } - std::vector<cmDocumentationEntry> commands; - std::vector<cmDocumentationEntry> compatCommands; - std::map<std::string,cmDocumentationSection *> propDocs; std::vector<cmDocumentationEntry> generators; - hcm.GetCommandDocumentation(commands, true, false); - hcm.GetCommandDocumentation(compatCommands, false, true); hcm.GetGeneratorDocumentation(generators); - hcm.GetPropertiesDocumentation(propDocs); doc.SetName("cmake"); doc.SetSection("Name",cmDocumentationName); doc.SetSection("Usage",cmDocumentationUsage); - doc.SetSection("Description",cmDocumentationDescription); doc.AppendSection("Generators",generators); doc.PrependSection("Options",cmDocumentationOptions); - doc.SetSection("Commands",commands); - doc.SetSection("Compatilbility Commands", compatCommands); - doc.SetSections(propDocs); return (doc.PrintRequestedDocumentation(std::cout)? 0:1); } diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 83be32d..f8f215f 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -43,83 +43,6 @@ static const char *cmDocumentationStandardOptions[][3] = }; //---------------------------------------------------------------------------- -static const char *cmModulesDocumentationDescription[][3] = -{ - {0, - " CMake Modules - Modules coming with CMake, the Cross-Platform Makefile " - "Generator.", 0}, -// CMAKE_DOCUMENTATION_OVERVIEW, - {0, - "This is the documentation for the modules and scripts coming with CMake. " - "Using these modules you can check the computer system for " - "installed software packages, features of the compiler and the " - "existence of headers to name just a few.", 0}, - {0,0,0} -}; - -//---------------------------------------------------------------------------- -static const char *cmCustomModulesDocumentationDescription[][3] = -{ - {0, - " Custom CMake Modules - Additional Modules for CMake.", 0}, -// CMAKE_DOCUMENTATION_OVERVIEW, - {0, - "This is the documentation for additional modules and scripts for CMake. " - "Using these modules you can check the computer system for " - "installed software packages, features of the compiler and the " - "existence of headers to name just a few.", 0}, - {0,0,0} -}; - -//---------------------------------------------------------------------------- -static const char *cmPropertiesDocumentationDescription[][3] = -{ - {0, - " CMake Properties - Properties supported by CMake, " - "the Cross-Platform Makefile Generator.", 0}, -// CMAKE_DOCUMENTATION_OVERVIEW, - {0, - "This is the documentation for the properties supported by CMake. " - "Properties can have different scopes. They can either be assigned to a " - "source file, a directory, a target or globally to CMake. By modifying the " - "values of properties the behaviour of the build system can be customized.", - 0}, - {0,0,0} -}; - -//---------------------------------------------------------------------------- -static const char *cmCompatCommandsDocumentationDescription[][3] = -{ - {0, - " CMake Compatibility Listfile Commands - " - "Obsolete commands supported by CMake for compatibility.", 0}, -// CMAKE_DOCUMENTATION_OVERVIEW, - {0, - "This is the documentation for now obsolete listfile commands from previous " - "CMake versions, which are still supported for compatibility reasons. You " - "should instead use the newer, faster and shinier new commands. ;-)", 0}, - {0,0,0} -}; - -//---------------------------------------------------------------------------- -static const char *cmDocumentationModulesHeader[][3] = -{ - {0, - "The following modules are provided with CMake. " - "They can be used with INCLUDE(ModuleName).", 0}, - {0,0,0} -}; - -//---------------------------------------------------------------------------- -static const char *cmDocumentationCustomModulesHeader[][3] = -{ - {0, - "The following modules are also available for CMake. " - "They can be used with INCLUDE(ModuleName).", 0}, - {0,0,0} -}; - -//---------------------------------------------------------------------------- static const char *cmDocumentationGeneratorsHeader[][3] = { {0, @@ -128,89 +51,6 @@ static const char *cmDocumentationGeneratorsHeader[][3] = }; //---------------------------------------------------------------------------- -static const char *cmDocumentationStandardSeeAlso[][3] = -{ - {0, - "The following resources are available to get help using CMake:", 0}, - {"Home Page", - "http://www.cmake.org", - "The primary starting point for learning about CMake."}, - {"Frequently Asked Questions", - "http://www.cmake.org/Wiki/CMake_FAQ", - "A Wiki is provided containing answers to frequently asked questions. "}, - {"Online Documentation", - "http://www.cmake.org/HTML/Documentation.html", - "Links to available documentation may be found on this web page."}, - {"Mailing List", - "http://www.cmake.org/HTML/MailingLists.html", - "For help and discussion about using cmake, a mailing list is provided at " - "cmake@cmake.org. " - "The list is member-post-only but one may sign up on the CMake web page. " - "Please first read the full documentation at " - "http://www.cmake.org before posting questions to the list."}, - {0,0,0} -}; - -//---------------------------------------------------------------------------- -static const char *cmDocumentationCopyright[][3] = -{ - {0, - "Copyright 2000-2012 Kitware, Inc., Insight Software Consortium. " - "All rights reserved.", 0}, - {0, - "Redistribution and use in source and binary forms, with or without " - "modification, are permitted provided that the following conditions are " - "met:", 0}, - {"", - "Redistributions of source code must retain the above copyright notice, " - "this list of conditions and the following disclaimer.", 0}, - {"", - "Redistributions in binary form must reproduce the above copyright " - "notice, this list of conditions and the following disclaimer in the " - "documentation and/or other materials provided with the distribution.", - 0}, - {"", - "Neither the names of Kitware, Inc., the Insight Software Consortium, " - "nor the names of their contributors may be used to endorse or promote " - "products derived from this software without specific prior written " - "permission.", 0}, - {0, - "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS " - "\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT " - "LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR " - "A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT " - "HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, " - "SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT " - "LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, " - "DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY " - "THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT " - "(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE " - "OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", - 0}, - {0, 0, 0} -}; - -//---------------------------------------------------------------------------- -#define DOCUMENT_INTRO(type, default_name, desc) \ - static char const *cmDocumentation##type##Intro[2] = { default_name, desc }; -#define GET_DOCUMENT_INTRO(type) cmDocumentation##type##Intro - -DOCUMENT_INTRO(Modules, "cmakemodules", - "Reference of available CMake modules."); -DOCUMENT_INTRO(CustomModules, "cmakecustommodules", - "Reference of available CMake custom modules."); -DOCUMENT_INTRO(Policies, "cmakepolicies", - "Reference of CMake policies."); -DOCUMENT_INTRO(Properties, "cmakeprops", - "Reference of CMake properties."); -DOCUMENT_INTRO(Variables, "cmakevars", - "Reference of CMake variables."); -DOCUMENT_INTRO(Commands, "cmakecommands", - "Reference of available CMake commands."); -DOCUMENT_INTRO(CompatCommands, "cmakecompat", - "Reference of CMake compatibility commands."); - -//---------------------------------------------------------------------------- cmDocumentation::cmDocumentation() :CurrentFormatter(0) { @@ -222,11 +62,6 @@ cmDocumentation::cmDocumentation() //---------------------------------------------------------------------------- cmDocumentation::~cmDocumentation() { - for(std::vector< char* >::iterator i = this->ModuleStrings.begin(); - i != this->ModuleStrings.end(); ++i) - { - delete [] *i; - } for(std::map<std::string,cmDocumentationSection *>::iterator i = this->AllSections.begin(); i != this->AllSections.end(); ++i) @@ -236,30 +71,6 @@ cmDocumentation::~cmDocumentation() } //---------------------------------------------------------------------------- -bool cmDocumentation::PrintCopyright(std::ostream& os) -{ - cmDocumentationSection *sec = this->AllSections["Copyright"]; - const std::vector<cmDocumentationEntry> &entries = sec->GetEntries(); - for(std::vector<cmDocumentationEntry>::const_iterator op = entries.begin(); - op != entries.end(); ++op) - { - if(op->Name.size()) - { - os << " * "; - this->TextFormatter.SetIndent(" "); - this->TextFormatter.PrintColumn(os, op->Brief.c_str()); - } - else - { - this->TextFormatter.SetIndent(""); - this->TextFormatter.PrintColumn(os, op->Brief.c_str()); - } - os << "\n"; - } - return true; -} - -//---------------------------------------------------------------------------- bool cmDocumentation::PrintVersion(std::ostream& os) { os << this->GetNameString() << " version " @@ -281,111 +92,31 @@ void cmDocumentation::ClearSections() { this->PrintSections.erase(this->PrintSections.begin(), this->PrintSections.end()); - this->ModulesFound.clear(); -} - -//---------------------------------------------------------------------------- -void cmDocumentation::AddDocumentIntroToPrint(const char* intro[2]) -{ - const char* docname = this->GetDocName(false); - if(intro && docname) - { - cmDocumentationSection* section; - std::string desc(""); - - desc += docname; - desc += " - "; - desc += intro[1]; - - section = new cmDocumentationSection("Introduction", "NAME"); - section->Append(0, desc.c_str(), 0); - this->PrintSections.push_back(section); - } } //---------------------------------------------------------------------------- -bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os, - const char* docname) +bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os) { - // Handle Document Name. docname==0 disables intro. - this->SetDocName(""); - if (docname) - { - if (*docname) - this->SetDocName(docname); - else // empty string was given. select default if possible - this->SetDocName(this->GetDefaultDocName(ht)); - } - switch (ht) { case cmDocumentation::Usage: return this->PrintDocumentationUsage(os); case cmDocumentation::Single: - return this->PrintDocumentationSingle(os); case cmDocumentation::SingleModule: - return this->PrintDocumentationSingleModule(os); case cmDocumentation::SinglePolicy: - return this->PrintDocumentationSinglePolicy(os); case cmDocumentation::SingleProperty: - return this->PrintDocumentationSingleProperty(os); case cmDocumentation::SingleVariable: - return this->PrintDocumentationSingleVariable(os); case cmDocumentation::List: - this->PrintDocumentationList(os,"Commands"); - this->PrintDocumentationList(os,"Compatibility Commands"); - return true; case cmDocumentation::ModuleList: - // find the modules first, print the custom module docs only if - // any custom modules have been found actually, Alex - this->CreateCustomModulesSection(); - this->CreateModulesSection(); - if (this->AllSections.find("Custom CMake Modules") - != this->AllSections.end()) - { - this->PrintDocumentationList(os,"Custom CMake Modules"); - } - this->PrintDocumentationList(os,"Modules"); - return true; case cmDocumentation::PropertyList: - this->PrintDocumentationList(os,"Properties Description"); - for (std::vector<std::string>::iterator i = - this->PropertySections.begin(); - i != this->PropertySections.end(); ++i) - { - this->PrintDocumentationList(os,i->c_str()); - } - return true; case cmDocumentation::VariableList: - for (std::vector<std::string>::iterator i = - this->VariableSections.begin(); - i != this->VariableSections.end(); ++i) - { - this->PrintDocumentationList(os,i->c_str()); - } - return true; case cmDocumentation::PolicyList: - this->PrintDocumentationList(os,"Policies"); - return true; - case cmDocumentation::Full: - return this->PrintDocumentationFull(os); case cmDocumentation::Modules: - return this->PrintDocumentationModules(os); - case cmDocumentation::CustomModules: - return this->PrintDocumentationCustomModules(os); case cmDocumentation::Policies: - return this->PrintDocumentationPolicies(os); case cmDocumentation::Properties: - return this->PrintDocumentationProperties(os); case cmDocumentation::Variables: - return this->PrintDocumentationVariables(os); case cmDocumentation::Commands: - return this->PrintDocumentationCurrentCommands(os); - case cmDocumentation::CompatCommands: - return this->PrintDocumentationCompatCommands(os); - - case cmDocumentation::Copyright: - return this->PrintCopyright(os); + return false; case cmDocumentation::Version: return this->PrintVersion(os); default: return false; @@ -393,184 +124,6 @@ bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os, } //---------------------------------------------------------------------------- -bool cmDocumentation::CreateModulesSection() -{ - cmDocumentationSection *sec = - new cmDocumentationSection("Standard CMake Modules", "MODULES"); - this->AllSections["Modules"] = sec; - std::string cmakeModules = this->CMakeRoot; - cmakeModules += "/Modules"; - cmsys::Directory dir; - dir.Load(cmakeModules.c_str()); - if (dir.GetNumberOfFiles() > 0) - { - sec->Append(cmDocumentationModulesHeader[0]); - sec->Append(cmModulesDocumentationDescription); - this->CreateModuleDocsForDir(dir, *this->AllSections["Modules"]); - } - return true; -} - -//---------------------------------------------------------------------------- -bool cmDocumentation::CreateCustomModulesSection() -{ - bool sectionHasHeader = false; - - std::vector<std::string> dirs; - cmSystemTools::ExpandListArgument(this->CMakeModulePath, dirs); - - for(std::vector<std::string>::const_iterator dirIt = dirs.begin(); - dirIt != dirs.end(); - ++dirIt) - { - cmsys::Directory dir; - dir.Load(dirIt->c_str()); - if (dir.GetNumberOfFiles() > 0) - { - if (!sectionHasHeader) - { - cmDocumentationSection *sec = - new cmDocumentationSection("Custom CMake Modules","CUSTOM MODULES"); - this->AllSections["Custom CMake Modules"] = sec; - sec->Append(cmDocumentationCustomModulesHeader[0]); - sec->Append(cmCustomModulesDocumentationDescription); - sectionHasHeader = true; - } - this->CreateModuleDocsForDir - (dir, *this->AllSections["Custom CMake Modules"]); - } - } - - return true; -} - -//---------------------------------------------------------------------------- -void cmDocumentation -::CreateModuleDocsForDir(cmsys::Directory& dir, - cmDocumentationSection &moduleSection) -{ - // sort the files alphabetically, so the docs for one module are easier - // to find than if they are in random order - std::vector<std::string> sortedFiles; - for(unsigned int i = 0; i < dir.GetNumberOfFiles(); ++i) - { - sortedFiles.push_back(dir.GetFile(i)); - } - std::sort(sortedFiles.begin(), sortedFiles.end()); - - for(std::vector<std::string>::const_iterator fname = sortedFiles.begin(); - fname!=sortedFiles.end(); ++fname) - { - if(fname->length() > 6) - { - if(fname->substr(fname->length()-6, 6) == ".cmake") - { - std::string moduleName = fname->substr(0, fname->length()-6); - // this check is to avoid creating documentation for the modules with - // the same name in multiple directories of CMAKE_MODULE_PATH - if (this->ModulesFound.find(moduleName) == this->ModulesFound.end()) - { - this->ModulesFound.insert(moduleName); - std::string path = dir.GetPath(); - path += "/"; - path += (*fname); - this->CreateSingleModule(path.c_str(), moduleName.c_str(), - moduleSection); - } - } - } - } -} - -//---------------------------------------------------------------------------- -bool cmDocumentation::CreateSingleModule(const char* fname, - const char* moduleName, - cmDocumentationSection &moduleSection) -{ - std::ifstream fin(fname); - if(!fin) - { - std::cerr << "Internal error: can not open module." << fname << std::endl; - return false; - } - std::string line; - std::string text; - std::string brief; - brief = " "; - bool newParagraph = true; - while ( fin && cmSystemTools::GetLineFromStream(fin, line) ) - { - if(line.size() && line[0] == '#') - { - // blank line - if(line.size() <= 2) - { - text += "\n"; - newParagraph = true; - } - else if(line[2] == '-') - { - brief = line.c_str()+4; - } - else - { - // two spaces - if(line[1] == ' ' && line[2] == ' ') - { - if(!newParagraph) - { - text += "\n"; - newParagraph = true; - } - // Skip #, and leave space for preformatted - text += line.c_str()+1; - text += "\n"; - } - else if(line[1] == ' ') - { - if(!newParagraph) - { - text += " "; - } - newParagraph = false; - // skip # and space - text += line.c_str()+2; - } - else - { - if(!newParagraph) - { - text += " "; - } - newParagraph = false; - // skip # - text += line.c_str()+1; - } - } - } - else - { - break; - } - } - - if(text.length() < 2 && brief.length() == 1) - { - return false; - } - - char* pname = strcpy(new char[strlen(moduleName)+1], moduleName); - char* ptext = strcpy(new char[text.length()+1], text.c_str()); - this->ModuleStrings.push_back(pname); - this->ModuleStrings.push_back(ptext); - char* pbrief = strcpy(new char[brief.length()+1], brief.c_str()); - this->ModuleStrings.push_back(pbrief); - moduleSection.Append(pname, pbrief, ptext); - return true; -} - - -//---------------------------------------------------------------------------- bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os) { bool result = true; @@ -587,7 +140,6 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os) // given stream. std::ofstream* fout = 0; std::ostream* s = &os; - std::string docname(""); if(i->Filename.length() > 0) { fout = new std::ofstream(i->Filename.c_str(), std::ios::out); @@ -599,14 +151,10 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os) { result = false; } - if(i->Filename != "-") - { - docname = cmSystemTools::GetFilenameWithoutLastExtension(i->Filename); - } } // Print this documentation type to the stream. - if(!this->PrintDocumentation(i->HelpType, *s, docname.c_str()) || !*s) + if(!this->PrintDocumentation(i->HelpType, *s) || !*s) { result = false; } @@ -667,29 +215,9 @@ void cmDocumentation::addCommonStandardDocSections() { cmDocumentationSection *sec; - sec = new cmDocumentationSection("Author","AUTHOR"); - sec->Append(cmDocumentationEntry - (0, - "This manual page was generated by the \"--help-man\" option.", - 0)); - this->AllSections["Author"] = sec; - - sec = new cmDocumentationSection("Copyright","COPYRIGHT"); - sec->Append(cmDocumentationCopyright); - this->AllSections["Copyright"] = sec; - - sec = new cmDocumentationSection("See Also","SEE ALSO"); - sec->Append(cmDocumentationStandardSeeAlso); - this->AllSections["Standard See Also"] = sec; - sec = new cmDocumentationSection("Options","OPTIONS"); sec->Append(cmDocumentationStandardOptions); this->AllSections["Options"] = sec; - - sec = new cmDocumentationSection("Compatibility Commands", - "COMPATIBILITY COMMANDS"); - sec->Append(cmCompatCommandsDocumentationDescription); - this->AllSections["Compatibility Commands"] = sec; } //---------------------------------------------------------------------------- @@ -697,27 +225,9 @@ void cmDocumentation::addCMakeStandardDocSections() { cmDocumentationSection *sec; - sec = new cmDocumentationSection("Properties","PROPERTIES"); - sec->Append(cmPropertiesDocumentationDescription); - this->AllSections["Properties Description"] = sec; - sec = new cmDocumentationSection("Generators","GENERATORS"); sec->Append(cmDocumentationGeneratorsHeader); this->AllSections["Generators"] = sec; - - this->PropertySections.push_back("Properties of Global Scope"); - this->PropertySections.push_back("Properties on Directories"); - this->PropertySections.push_back("Properties on Targets"); - this->PropertySections.push_back("Properties on Tests"); - this->PropertySections.push_back("Properties on Source Files"); - this->PropertySections.push_back("Properties on Cache Entries"); - - this->VariableSections.push_back("Variables that Provide Information"); - this->VariableSections.push_back("Variables That Change Behavior"); - this->VariableSections.push_back("Variables That Describe the System"); - this->VariableSections.push_back("Variables that Control the Build"); - this->VariableSections.push_back("Variables for Languages"); - } //---------------------------------------------------------------------------- @@ -736,22 +246,6 @@ void cmDocumentation::addCPackStandardDocSections() sec = new cmDocumentationSection("Generators","GENERATORS"); sec->Append(cmDocumentationGeneratorsHeader); this->AllSections["Generators"] = sec; - - this->VariableSections.push_back( - "Variables common to all CPack generators"); -} - -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); - } } //---------------------------------------------------------------------------- @@ -826,10 +320,10 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv, } else if(strcmp(argv[i], "--help-custom-modules") == 0) { - help.HelpType = cmDocumentation::CustomModules; GET_OPT_ARGUMENT(help.Filename); - help.HelpForm = this->GetFormFromFilename(help.Filename, - &help.ManSection); + cmSystemTools::Message( + "Warning: --help-custom-modules no longer supported"); + return true; } else if(strcmp(argv[i], "--help-commands") == 0) { @@ -840,30 +334,28 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv, } else if(strcmp(argv[i], "--help-compatcommands") == 0) { - help.HelpType = cmDocumentation::CompatCommands; GET_OPT_ARGUMENT(help.Filename); - help.HelpForm = this->GetFormFromFilename(help.Filename, - &help.ManSection); + cmSystemTools::Message( + "Warning: --help-compatcommands no longer supported"); + return true; } else if(strcmp(argv[i], "--help-full") == 0) { - help.HelpType = cmDocumentation::Full; GET_OPT_ARGUMENT(help.Filename); - help.HelpForm = this->GetFormFromFilename(help.Filename, - &help.ManSection); + cmSystemTools::Message("Warning: --help-full no longer supported"); + return true; } else if(strcmp(argv[i], "--help-html") == 0) { - help.HelpType = cmDocumentation::Full; GET_OPT_ARGUMENT(help.Filename); - help.HelpForm = cmDocumentation::HTMLForm; + cmSystemTools::Message("Warning: --help-html no longer supported"); + return true; } else if(strcmp(argv[i], "--help-man") == 0) { - help.HelpType = cmDocumentation::Full; GET_OPT_ARGUMENT(help.Filename); - help.HelpForm = cmDocumentation::ManForm; - help.ManSection = 1; + cmSystemTools::Message("Warning: --help-man no longer supported"); + return true; } else if(strcmp(argv[i], "--help-command") == 0) { @@ -938,9 +430,9 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv, } else if(strcmp(argv[i], "--copyright") == 0) { - help.HelpType = cmDocumentation::Copyright; GET_OPT_ARGUMENT(help.Filename); - help.HelpForm = cmDocumentation::UsageForm; + cmSystemTools::Message("Warning: --copyright no longer supported"); + return true; } else if((strcmp(argv[i], "--version") == 0) || (strcmp(argv[i], "-version") == 0) || @@ -989,12 +481,6 @@ void cmDocumentation::SetName(const char* name) } //---------------------------------------------------------------------------- -void cmDocumentation::SetDocName(const char *docname) -{ - this->DocName = docname?docname:""; -} - -//---------------------------------------------------------------------------- void cmDocumentation::SetSection(const char *name, cmDocumentationSection *section) { @@ -1131,226 +617,6 @@ void cmDocumentation::PrependSection(const char *name, } //---------------------------------------------------------------------------- -void cmDocumentation::SetSeeAlsoList(const char *data[][3]) -{ - cmDocumentationSection *sec = - new cmDocumentationSection("See Also", "SEE ALSO"); - this->AllSections["See Also"] = sec; - this->SeeAlsoString = ".B "; - int i = 0; - while(data[i][1]) - { - this->SeeAlsoString += data[i][1]; - this->SeeAlsoString += data[i+1][1]? "(1), ":"(1)"; - ++i; - } - sec->Append(0,this->SeeAlsoString.c_str(),0); - sec->Append(cmDocumentationStandardSeeAlso); -} - -//---------------------------------------------------------------------------- -bool cmDocumentation::PrintDocumentationGeneric(std::ostream& os, - const char *section) -{ - if(this->AllSections.find(section) == this->AllSections.end()) - { - os << "Internal error: " << section << " list is empty." << std::endl; - return false; - } - if(this->CurrentArgument.length() == 0) - { - os << "Required argument missing.\n"; - return false; - } - const std::vector<cmDocumentationEntry> &entries = - this->AllSections[section]->GetEntries(); - for(std::vector<cmDocumentationEntry>::const_iterator ei = - entries.begin(); - ei != entries.end(); ++ei) - { - if(this->CurrentArgument == ei->Name) - { - this->PrintDocumentationCommand(os, *ei); - return true; - } - } - return false; -} - -//---------------------------------------------------------------------------- -bool cmDocumentation::PrintDocumentationSingle(std::ostream& os) -{ - if (this->PrintDocumentationGeneric(os,"Commands")) - { - return true; - } - if (this->PrintDocumentationGeneric(os,"Compatibility Commands")) - { - return true; - } - - // Argument was not a command. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() - << "\" to --help-command is not a CMake command. " - << "Use --help-command-list to see all commands.\n"; - return false; -} - -//---------------------------------------------------------------------------- -bool cmDocumentation::PrintDocumentationSingleModule(std::ostream& os) -{ - if(this->CurrentArgument.length() == 0) - { - os << "Argument --help-module needs a module name.\n"; - return false; - } - - std::string moduleName; - // find the module - std::vector<std::string> dirs; - cmSystemTools::ExpandListArgument(this->CMakeModulePath, dirs); - for(std::vector<std::string>::const_iterator dirIt = dirs.begin(); - dirIt != dirs.end(); - ++dirIt) - { - moduleName = *dirIt; - moduleName += "/"; - moduleName += this->CurrentArgument; - moduleName += ".cmake"; - if(cmSystemTools::FileExists(moduleName.c_str())) - { - break; - } - moduleName = ""; - } - - if (moduleName.empty()) - { - moduleName = this->CMakeRoot; - moduleName += "/Modules/"; - moduleName += this->CurrentArgument; - moduleName += ".cmake"; - if(!cmSystemTools::FileExists(moduleName.c_str())) - { - moduleName = ""; - } - } - - if(!moduleName.empty()) - { - cmDocumentationSection *sec = - new cmDocumentationSection("Standard CMake Modules", "MODULES"); - this->AllSections["Modules"] = sec; - if (this->CreateSingleModule(moduleName.c_str(), - this->CurrentArgument.c_str(), - *this->AllSections["Modules"])) - { - if(this->AllSections["Modules"]->GetEntries().size()) - { - this->PrintDocumentationCommand - (os, this->AllSections["Modules"]->GetEntries()[0]); - os << "\n Defined in: "; - os << moduleName << "\n"; - return true; - } - else - { - return false; - } - } - } - - // Argument was not a module. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() - << "\" to --help-module is not a CMake module.\n"; - return false; -} - -//---------------------------------------------------------------------------- -bool cmDocumentation::PrintDocumentationSingleProperty(std::ostream& os) -{ - bool done = false; - for (std::vector<std::string>::iterator i = - this->PropertySections.begin(); - !done && i != this->PropertySections.end(); ++i) - { - done = this->PrintDocumentationGeneric(os,i->c_str()); - } - - if (done) - { - return true; - } - - // Argument was not a command. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() - << "\" to --help-property is not a CMake property. " - << "Use --help-property-list to see all properties.\n"; - return false; -} - -//---------------------------------------------------------------------------- -bool cmDocumentation::PrintDocumentationSinglePolicy(std::ostream& os) -{ - if (this->PrintDocumentationGeneric(os,"Policies")) - { - return true; - } - - // Argument was not a policy. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() - << "\" to --help-policy is not a CMake policy.\n"; - return false; -} - -//---------------------------------------------------------------------------- -bool cmDocumentation::PrintDocumentationSingleVariable(std::ostream& os) -{ - bool done = false; - for (std::vector<std::string>::iterator i = - this->VariableSections.begin(); - !done && i != this->VariableSections.end(); ++i) - { - done = this->PrintDocumentationGeneric(os,i->c_str()); - } - - if (done) - { - return true; - } - - // Argument was not a variable. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() - << "\" to --help-variable is not a defined variable. " - << "Use --help-variable-list to see all defined variables.\n"; - return false; -} - -//---------------------------------------------------------------------------- -bool cmDocumentation::PrintDocumentationList(std::ostream& os, - const char *section) -{ - if(this->AllSections.find(section) == this->AllSections.end()) - { - os << "Internal error: " << section << " list is empty." << std::endl; - return false; - } - - const std::vector<cmDocumentationEntry> &entries = - this->AllSections[section]->GetEntries(); - for(std::vector<cmDocumentationEntry>::const_iterator ei = - entries.begin(); - ei != entries.end(); ++ei) - { - if(ei->Name.size()) - { - os << ei->Name << std::endl; - } - } - return true; -} - -//---------------------------------------------------------------------------- bool cmDocumentation::PrintDocumentationUsage(std::ostream& os) { this->ClearSections(); @@ -1365,212 +631,6 @@ bool cmDocumentation::PrintDocumentationUsage(std::ostream& os) } //---------------------------------------------------------------------------- -bool cmDocumentation::PrintDocumentationFull(std::ostream& os) -{ - this->CreateFullDocumentation(); - this->CurrentFormatter->PrintHeader(GetNameString(), GetNameString(), os); - this->Print(os); - this->CurrentFormatter->PrintFooter(os); - return true; -} - -//---------------------------------------------------------------------------- -bool cmDocumentation::PrintDocumentationModules(std::ostream& os) -{ - this->ClearSections(); - this->CreateModulesSection(); - this->AddDocumentIntroToPrint(GET_DOCUMENT_INTRO(Modules)); - this->AddSectionToPrint("Description"); - this->AddSectionToPrint("Modules"); - this->AddSectionToPrint("Copyright"); - this->AddSectionToPrint("See Also"); - this->CurrentFormatter->PrintHeader(GetDocName(), GetNameString(), os); - this->Print(os); - this->CurrentFormatter->PrintFooter(os); - return true; -} - -//---------------------------------------------------------------------------- -bool cmDocumentation::PrintDocumentationCustomModules(std::ostream& os) -{ - this->ClearSections(); - this->CreateCustomModulesSection(); - this->AddDocumentIntroToPrint(GET_DOCUMENT_INTRO(CustomModules)); - this->AddSectionToPrint("Description"); - this->AddSectionToPrint("Custom CMake Modules"); -// the custom modules are most probably not under Kitware's copyright, Alex -// this->AddSectionToPrint("Copyright"); - this->AddSectionToPrint("See Also"); - - this->CurrentFormatter->PrintHeader(GetDocName(), GetNameString(), os); - this->Print(os); - this->CurrentFormatter->PrintFooter(os); - return true; -} - -//---------------------------------------------------------------------------- -bool cmDocumentation::PrintDocumentationPolicies(std::ostream& os) -{ - this->ClearSections(); - this->AddDocumentIntroToPrint(GET_DOCUMENT_INTRO(Policies)); - this->AddSectionToPrint("Description"); - this->AddSectionToPrint("Policies"); - this->AddSectionToPrint("Copyright"); - this->AddSectionToPrint("See Also"); - - this->CurrentFormatter->PrintHeader(GetDocName(), GetNameString(), os); - this->Print(os); - this->CurrentFormatter->PrintFooter(os); - return true; -} - -//---------------------------------------------------------------------------- -bool cmDocumentation::PrintDocumentationProperties(std::ostream& os) -{ - this->ClearSections(); - this->AddDocumentIntroToPrint(GET_DOCUMENT_INTRO(Properties)); - this->AddSectionToPrint("Properties Description"); - for (std::vector<std::string>::iterator i = - this->PropertySections.begin(); - i != this->PropertySections.end(); ++i) - { - this->AddSectionToPrint(i->c_str()); - } - this->AddSectionToPrint("Copyright"); - this->AddSectionToPrint("Standard See Also"); - this->CurrentFormatter->PrintHeader(GetDocName(), GetNameString(), os); - this->Print(os); - this->CurrentFormatter->PrintFooter(os); - return true; -} - -//---------------------------------------------------------------------------- -bool cmDocumentation::PrintDocumentationVariables(std::ostream& os) -{ - this->ClearSections(); - this->AddDocumentIntroToPrint(GET_DOCUMENT_INTRO(Variables)); - for (std::vector<std::string>::iterator i = - this->VariableSections.begin(); - i != this->VariableSections.end(); ++i) - { - this->AddSectionToPrint(i->c_str()); - } - this->AddSectionToPrint("Copyright"); - this->AddSectionToPrint("Standard See Also"); - this->CurrentFormatter->PrintHeader(GetDocName(), GetNameString(), os); - this->Print(os); - this->CurrentFormatter->PrintFooter(os); - return true; -} - -//---------------------------------------------------------------------------- -bool cmDocumentation::PrintDocumentationCurrentCommands(std::ostream& os) -{ - this->ClearSections(); - this->AddDocumentIntroToPrint(GET_DOCUMENT_INTRO(Commands)); - this->AddSectionToPrint("Commands"); - this->AddSectionToPrint("Copyright"); - this->AddSectionToPrint("Standard See Also"); - this->CurrentFormatter->PrintHeader(GetDocName(), GetNameString(), os); - this->Print(os); - this->CurrentFormatter->PrintFooter(os); - return true; -} - -//---------------------------------------------------------------------------- -bool cmDocumentation::PrintDocumentationCompatCommands(std::ostream& os) -{ - this->ClearSections(); - this->AddDocumentIntroToPrint(GET_DOCUMENT_INTRO(CompatCommands)); - this->AddSectionToPrint("Compatibility Commands Description"); - this->AddSectionToPrint("Compatibility Commands"); - this->AddSectionToPrint("Copyright"); - this->AddSectionToPrint("Standard See Also"); - this->CurrentFormatter->PrintHeader(GetDocName(), GetNameString(), os); - this->Print(os); - this->CurrentFormatter->PrintFooter(os); - return true; -} - -//---------------------------------------------------------------------------- -void cmDocumentation -::PrintDocumentationCommand(std::ostream& os, - const cmDocumentationEntry &entry) -{ - // the string "SingleItem" will be used in a few places to detect the case - // that only the documentation for a single item is printed - cmDocumentationSection *sec = new cmDocumentationSection("SingleItem",""); - sec->Append(entry); - this->AllSections["temp"] = sec; - this->ClearSections(); - this->AddSectionToPrint("temp"); - this->Print(os); - this->AllSections.erase("temp"); - delete sec; -} - -//---------------------------------------------------------------------------- -void cmDocumentation::CreateFullDocumentation() -{ - this->ClearSections(); - this->CreateCustomModulesSection(); - this->CreateModulesSection(); - - std::set<std::string> emitted; - this->AddSectionToPrint("Name"); - emitted.insert("Name"); - this->AddSectionToPrint("Usage"); - emitted.insert("Usage"); - this->AddSectionToPrint("Description"); - emitted.insert("Description"); - this->AddSectionToPrint("Options"); - emitted.insert("Options"); - this->AddSectionToPrint("Generators"); - emitted.insert("Generators"); - this->AddSectionToPrint("Commands"); - emitted.insert("Commands"); - - - this->AddSectionToPrint("Properties Description"); - emitted.insert("Properties Description"); - for (std::vector<std::string>::iterator i = - this->PropertySections.begin(); - i != this->PropertySections.end(); ++i) - { - this->AddSectionToPrint(i->c_str()); - emitted.insert(i->c_str()); - } - - emitted.insert("Copyright"); - emitted.insert("See Also"); - emitted.insert("Standard See Also"); - emitted.insert("Author"); - - // add any sections not yet written out, or to be written out - for (std::map<std::string, cmDocumentationSection*>::iterator i = - this->AllSections.begin(); - i != this->AllSections.end(); ++i) - { - if (emitted.find(i->first) == emitted.end()) - { - this->AddSectionToPrint(i->first.c_str()); - } - } - - this->AddSectionToPrint("Copyright"); - - if(this->CurrentFormatter->GetForm() == ManForm) - { - this->AddSectionToPrint("See Also"); - this->AddSectionToPrint("Author"); - } - else - { - this->AddSectionToPrint("Standard See Also"); - } -} - -//---------------------------------------------------------------------------- void cmDocumentation::SetForm(Form f, int manSection) { switch(f) @@ -1612,41 +672,6 @@ const char* cmDocumentation::GetNameString() const } //---------------------------------------------------------------------------- -const char* cmDocumentation::GetDocName(bool fallbackToNameString) const -{ - if (this->DocName.length() > 0) - { - return this->DocName.c_str(); - } - else if (fallbackToNameString) - { - return this->GetNameString(); - } - else - return 0; -} - -//---------------------------------------------------------------------------- -#define CASE_DEFAULT_DOCNAME(doctype) \ - case cmDocumentation::doctype : \ - return GET_DOCUMENT_INTRO(doctype)[0]; -const char* cmDocumentation::GetDefaultDocName(Type ht) const -{ - switch (ht) - { - CASE_DEFAULT_DOCNAME(Modules) - CASE_DEFAULT_DOCNAME(CustomModules) - CASE_DEFAULT_DOCNAME(Policies) - CASE_DEFAULT_DOCNAME(Properties) - CASE_DEFAULT_DOCNAME(Variables) - CASE_DEFAULT_DOCNAME(Commands) - CASE_DEFAULT_DOCNAME(CompatCommands) - default: break; - } - return 0; -} - -//---------------------------------------------------------------------------- bool cmDocumentation::IsOption(const char* arg) const { return ((arg[0] == '-') || (strcmp(arg, "/V") == 0) || diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 151c242..fac3748 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -38,22 +38,6 @@ public: ~cmDocumentation(); /** - * An helper type pair for [structured] documented modules. - * The comment of those module contains structure markup - * which makes it possible to retrieve the documentation - * of variables, macros and functions defined in the module. - * - first is the filename of the module - * - second is the section of the doc the module belongs too - */ - typedef std::pair<std::string,std::string> documentedModuleSectionPair_t; - /** - * A list of documented module(s). - */ - typedef std::list<documentedModuleSectionPair_t> documentedModulesList_t; - - // High-level interface for standard documents: - - /** * Check command line arguments for documentation options. Returns * true if documentation options are found, and false otherwise. * When true is returned, PrintRequestedDocumentation should be @@ -73,7 +57,7 @@ public: bool PrintRequestedDocumentation(std::ostream& os); /** Print help of the given type. */ - bool PrintDocumentation(Type ht, std::ostream& os, const char* docname=0); + bool PrintDocumentation(Type ht, std::ostream& os); void SetShowGenerators(bool showGen) { this->ShowGenerators = showGen; } @@ -81,7 +65,7 @@ public: void SetName(const char* name); /** Set a section of the documentation. Typical sections include Name, - Usage, Description, Options, SeeAlso */ + Usage, Description, Options */ void SetSection(const char *sectionName, cmDocumentationSection *section); void SetSection(const char *sectionName, @@ -123,17 +107,12 @@ public: */ void AddSectionToPrint(const char *section); - void SetSeeAlsoList(const char *data[][3]); - /** Clear all previously added sections of help. */ void ClearSections(); /** Set cmake root so we can find installed files */ void SetCMakeRoot(const char* root) { this->CMakeRoot = root;} - /** Set CMAKE_MODULE_PATH so we can find additional cmake modules */ - void SetCMakeModulePath(const char* path) { this->CMakeModulePath = path;} - static Form GetFormFromFilename(const std::string& filename, int* ManSection); @@ -149,62 +128,21 @@ public: /** Add the CPack standard documentation section(s) */ void addCPackStandardDocSections(); - /** Add automatic variables sections */ - void addAutomaticVariableSections(const std::string& section); - private: void SetForm(Form f, int manSection); - void SetDocName(const char* docname); - - bool CreateSingleModule(const char* fname, - const char* moduleName, - cmDocumentationSection &sec); - void CreateModuleDocsForDir(cmsys::Directory& dir, - cmDocumentationSection &moduleSection); - bool CreateModulesSection(); - bool CreateCustomModulesSection(); - void CreateFullDocumentation(); - void AddDocumentIntroToPrint(const char* intro[2]); - - bool PrintCopyright(std::ostream& os); bool PrintVersion(std::ostream& os); - bool PrintDocumentationGeneric(std::ostream& os, const char *section); - bool PrintDocumentationList(std::ostream& os, const char *section); - bool PrintDocumentationSingle(std::ostream& os); - bool PrintDocumentationSingleModule(std::ostream& os); - bool PrintDocumentationSingleProperty(std::ostream& os); - bool PrintDocumentationSinglePolicy(std::ostream& os); - bool PrintDocumentationSingleVariable(std::ostream& os); bool PrintDocumentationUsage(std::ostream& os); - bool PrintDocumentationFull(std::ostream& os); - bool PrintDocumentationModules(std::ostream& os); - bool PrintDocumentationCustomModules(std::ostream& os); - bool PrintDocumentationPolicies(std::ostream& os); - bool PrintDocumentationProperties(std::ostream& os); - bool PrintDocumentationVariables(std::ostream& os); - bool PrintDocumentationCurrentCommands(std::ostream& os); - bool PrintDocumentationCompatCommands(std::ostream& os); - void PrintDocumentationCommand(std::ostream& os, - const cmDocumentationEntry &entry); - const char* GetNameString() const; - const char* GetDocName(bool fallbackToNameString = true) const; - const char* GetDefaultDocName(Type ht) const; bool IsOption(const char* arg) const; bool ShowGenerators; std::string NameString; - std::string DocName; std::map<std::string,cmDocumentationSection*> AllSections; - std::string SeeAlsoString; std::string CMakeRoot; - std::string CMakeModulePath; - std::set<std::string> ModulesFound; - std::vector< char* > ModuleStrings; std::vector<const cmDocumentationSection *> PrintSections; std::string CurrentArgument; @@ -226,9 +164,6 @@ private: cmDocumentationFormatterRST RSTFormatter; cmDocumentationFormatterText TextFormatter; cmDocumentationFormatterUsage UsageFormatter; - - std::vector<std::string> PropertySections; - std::vector<std::string> VariableSections; }; #endif diff --git a/Source/cmDocumentationFormatter.h b/Source/cmDocumentationFormatter.h index 9278297..534a4de 100644 --- a/Source/cmDocumentationFormatter.h +++ b/Source/cmDocumentationFormatter.h @@ -27,8 +27,8 @@ public: enum Type { None, Usage, Single, SingleModule, SingleProperty, SingleVariable, List, ModuleList, PropertyList, VariableList, PolicyList, - Full, Properties, Variables, Modules, CustomModules, Commands, - CompatCommands, Copyright, Version, Policies, SinglePolicy }; + Properties, Variables, Modules, Commands, + Copyright, Version, Policies, SinglePolicy }; /** Forms of documentation output. */ enum Form { TextForm, HTMLForm, RSTForm, ManForm, UsageForm, DocbookForm }; diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 0731fc2..6ede28b 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -935,52 +935,6 @@ cmPolicies::GetPolicyStatus(cmPolicies::PolicyID id) return pos->second->Status; } -void cmPolicies::GetDocumentation(std::vector<cmDocumentationEntry>& v) -{ - // now loop over all the policies and set them as appropriate - std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i - = this->Policies.begin(); - for (;i != this->Policies.end(); ++i) - { - cmOStringStream full; - full << i->second->LongDescription; - full << "\nThis policy was introduced in CMake version "; - full << i->second->GetVersionString() << "."; - if(i->first != cmPolicies::CMP0000) - { - full << " " - << "CMake version |release| "; - // add in some more text here based on status - switch (i->second->Status) - { - case cmPolicies::WARN: - full << "warns when the policy is not set and uses OLD behavior. " - << "Use the cmake_policy command to set it to OLD or NEW " - << "explicitly."; - break; - case cmPolicies::OLD: - full << "defaults to the OLD behavior for this policy."; - break; - case cmPolicies::NEW: - full << "defaults to the NEW behavior for this policy."; - break; - case cmPolicies::REQUIRED_IF_USED: - full << "requires the policy to be set to NEW if you use it. " - << "Use the cmake_policy command to set it to NEW."; - break; - case cmPolicies::REQUIRED_ALWAYS: - full << "requires the policy to be set to NEW. " - << "Use the cmake_policy command to set it to NEW."; - break; - } - } - cmDocumentationEntry e(i->second->IDString.c_str(), - i->second->ShortDescription.c_str(), - full.str().c_str()); - v.push_back(e); - } -} - //---------------------------------------------------------------------------- std::string cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index e33171b..a9d1b49 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -116,9 +116,6 @@ public: ///! return an error string for when a required policy is unspecified std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id); - ///! Get docs for policies - void GetDocumentation(std::vector<cmDocumentationEntry>& v); - /** Represent a set of policy values. */ typedef std::map<PolicyID, PolicyStatus> PolicyMap; diff --git a/Source/cmPropertyDefinitionMap.cxx b/Source/cmPropertyDefinitionMap.cxx index 20fa07c..22f8218 100644 --- a/Source/cmPropertyDefinitionMap.cxx +++ b/Source/cmPropertyDefinitionMap.cxx @@ -35,63 +35,6 @@ void cmPropertyDefinitionMap } } -void cmPropertyDefinitionMap -::GetPropertiesDocumentation(std::map<std::string, - cmDocumentationSection *>& v) const -{ - for(cmPropertyDefinitionMap::const_iterator j = this->begin(); - j != this->end(); ++j) - { - // add a section if needed - std::string secName = j->second.GetDocumentationSection(); - // if a section was not specified then use the scope - if (!secName.size()) - { - switch (j->second.GetScope()) - { - case cmProperty::GLOBAL: - secName = "Properties of Global Scope"; - break; - case cmProperty::TARGET: - secName = "Properties on Targets"; - break; - case cmProperty::SOURCE_FILE: - secName = "Properties on Source Files"; - break; - case cmProperty::DIRECTORY: - secName = "Properties on Directories"; - break; - case cmProperty::TEST: - secName = "Properties on Tests"; - break; - case cmProperty::CACHE: - secName = "Properties on Cache Entries"; - break; - case cmProperty::VARIABLE: - secName = "Variables"; - break; - case cmProperty::CACHED_VARIABLE: - secName = "Cached Variables"; - break; - default: - secName = "Properties of Unknown Scope"; - break; - } - } - if (!v[secName]) - { - v[secName] = new - cmDocumentationSection(secName.c_str(), - cmSystemTools::UpperCase(secName).c_str()); - } - cmDocumentationEntry e = j->second.GetDocumentation(); - if (e.Brief.size() || e.Full.size()) - { - v[secName]->Append(e); - } - } -} - bool cmPropertyDefinitionMap::IsPropertyDefined(const char *name) { if (!name) diff --git a/Source/cmPropertyDefinitionMap.h b/Source/cmPropertyDefinitionMap.h index 007e265..1e569ad 100644 --- a/Source/cmPropertyDefinitionMap.h +++ b/Source/cmPropertyDefinitionMap.h @@ -32,9 +32,6 @@ public: // is a named property set to chain bool IsPropertyChained(const char *name); - - void GetPropertiesDocumentation(std::map<std::string, - cmDocumentationSection *>&) const; }; #endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f45f56f..1daf8b5 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1995,45 +1995,6 @@ void cmake::UpdateProgress(const char *msg, float prog) } } -void cmake::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v, - bool withCurrentCommands, - bool withCompatCommands) const -{ - for(RegisteredCommandsMap::const_iterator j = this->Commands.begin(); - j != this->Commands.end(); ++j) - { - if ((( withCompatCommands == false) && ( (*j).second->IsDiscouraged())) - || ((withCurrentCommands == false) && (!(*j).second->IsDiscouraged())) - || (!((*j).second->ShouldAppearInDocumentation())) - ) - { - continue; - } - - cmDocumentationEntry e((*j).second->GetName(), - (*j).second->GetTerseDocumentation(), - (*j).second->GetFullDocumentation()); - v.push_back(e); - } -} - -void cmake::GetPolicyDocumentation(std::vector<cmDocumentationEntry>& v) -{ - this->Policies->GetDocumentation(v); -} - -void cmake::GetPropertiesDocumentation(std::map<std::string, - cmDocumentationSection *>& v) -{ - // loop over the properties and put them into the doc structure - std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>::iterator i; - i = this->PropertyDefinitions.begin(); - for (;i != this->PropertyDefinitions.end(); ++i) - { - i->second.GetPropertiesDocumentation(v); - } -} - void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v) { for(RegisteredGeneratorsVector::const_iterator i = diff --git a/Source/cmake.h b/Source/cmake.h index 7dc3ccc..59461fe 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -269,20 +269,7 @@ class cmake ///! Get the variable watch object cmVariableWatch* GetVariableWatch() { return this->VariableWatch; } - /** Get the documentation entries for the supported commands. - * If withCurrentCommands is true, the documentation for the - * recommended set of commands is included. - * If withCompatCommands is true, the documentation for discouraged - * (compatibility) commands is included. - * You probably don't want to set both to false. - */ - void GetCommandDocumentation(std::vector<cmDocumentationEntry>& entries, - bool withCurrentCommands = true, - bool withCompatCommands = true) const; - void GetPropertiesDocumentation(std::map<std::string, - cmDocumentationSection *>&); void GetGeneratorDocumentation(std::vector<cmDocumentationEntry>&); - void GetPolicyDocumentation(std::vector<cmDocumentationEntry>& entries); ///! Set/Get a property of this target file void SetProperty(const char *prop, const char *value); @@ -519,13 +506,4 @@ private: "Enable warnings that are meant for the author"\ " of the CMakeLists.txt files."} - -#define CMAKE_STANDARD_INTRODUCTION \ - {0, \ - "CMake is a cross-platform build system generator. Projects " \ - "specify their build process with platform-independent CMake listfiles " \ - "included in each directory of a source tree with the name " \ - "CMakeLists.txt. " \ - "Users build a project by using CMake to generate a build system " \ - "for a native tool on their platform.", 0} #endif diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index a9fc15f..b05dec3 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -44,19 +44,6 @@ static const char * cmDocumentationUsage[][3] = {0,0,0} }; -//---------------------------------------------------------------------------- -static const char * cmDocumentationDescription[][3] = -{ - {0, - "The \"cmake\" executable is the CMake command-line interface. It may " - "be used to configure projects in scripts. Project configuration " - "settings " - "may be specified on the command line with the -D option. The -i option " - "will cause cmake to interactively prompt for such settings.", 0}, - CMAKE_STANDARD_INTRODUCTION, - {0,0,0} -}; - #define CMAKE_BUILD_OPTIONS \ " <dir> = Project binary directory to be built.\n" \ " --target <tgt> = Build <tgt> instead of default targets.\n" \ @@ -245,29 +232,6 @@ static const char * cmDocumentationOptions[][3] = {0,0,0} }; -//---------------------------------------------------------------------------- -static const char * cmDocumentationSeeAlso[][3] = -{ - {0, "ccmake", 0}, - {0, "cpack", 0}, - {0, "ctest", 0}, - {0, "cmakecommands", 0}, - {0, "cmakecompat", 0}, - {0, "cmakemodules", 0}, - {0, "cmakeprops", 0}, - {0, "cmakevars", 0}, - {0, 0, 0} -}; - -//---------------------------------------------------------------------------- -static const char * cmDocumentationNOTE[][3] = -{ - {0, - "CMake no longer configures a project when run with no arguments. " - "In order to configure the project in the current directory, run\n" - " cmake .", 0}, - {0,0,0} -}; #endif int do_cmake(int ac, char** av); @@ -381,57 +345,18 @@ int do_cmake(int ac, char** av) args.push_back(av[i]); } hcm.SetCacheArgs(args); - const char* modulePath = hcm.GetCacheDefinition("CMAKE_MODULE_PATH"); - if (modulePath) - { - doc.SetCMakeModulePath(modulePath); - } - std::vector<cmDocumentationEntry> commands; - std::vector<cmDocumentationEntry> policies; - std::vector<cmDocumentationEntry> compatCommands; std::vector<cmDocumentationEntry> generators; - std::map<std::string,cmDocumentationSection *> propDocs; - hcm.GetPolicyDocumentation(policies); - hcm.GetCommandDocumentation(commands, true, false); - hcm.GetCommandDocumentation(compatCommands, false, true); - hcm.GetPropertiesDocumentation(propDocs); hcm.GetGeneratorDocumentation(generators); doc.SetName("cmake"); doc.SetSection("Name",cmDocumentationName); doc.SetSection("Usage",cmDocumentationUsage); - doc.SetSection("Description",cmDocumentationDescription); doc.AppendSection("Generators",generators); doc.PrependSection("Options",cmDocumentationOptions); - doc.SetSection("Commands",commands); - doc.SetSection("Policies",policies); - doc.AppendSection("Compatibility Commands",compatCommands); - doc.SetSections(propDocs); - - cmDocumentationEntry e; - e.Brief = - "variables defined by cmake, that give information about the project, " - "and cmake"; - doc.PrependSection("Variables that Provide Information",e); - - doc.SetSeeAlsoList(cmDocumentationSeeAlso); - int result = doc.PrintRequestedDocumentation(std::cout)? 0:1; - - // If we were run with no arguments, but a CMakeLists.txt file - // exists, the user may have been trying to use the old behavior - // of cmake to build a project in-source. Print a message - // explaining the change to standard error and return an error - // condition in case the program is running from a script. - if((ac == 1) && cmSystemTools::FileExists("CMakeLists.txt")) - { - doc.ClearSections(); - doc.SetSection("NOTE", cmDocumentationNOTE); - doc.Print(cmDocumentation::UsageForm, 0, std::cerr); - return 1; - } - return result; + + return doc.PrintRequestedDocumentation(std::cout)? 0:1; } #else if ( ac == 1 ) diff --git a/Source/ctest.cxx b/Source/ctest.cxx index ece68f5..9798554 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -36,16 +36,6 @@ static const char * cmDocumentationUsage[][3] = }; //---------------------------------------------------------------------------- -static const char * cmDocumentationDescription[][3] = -{ - {0, - "The \"ctest\" executable is the CMake test driver program. " - "CMake-generated build trees created for projects that use " - "the ENABLE_TESTING and ADD_TEST commands have testing support. " - "This program will run the tests and report results.", 0}, - {0,0,0} -}; - //---------------------------------------------------------------------------- static const char * cmDocumentationOptions[][3] = { @@ -261,14 +251,6 @@ static const char * cmDocumentationOptions[][3] = {0,0,0} }; -//---------------------------------------------------------------------------- -static const char * cmDocumentationSeeAlso[][3] = -{ - {0, "cmake", 0}, - {0, "ccmake", 0}, - {0, 0, 0} -}; - // this is a test driver program for cmCTest. int main (int argc, char *argv[]) { @@ -309,20 +291,15 @@ int main (int argc, char *argv[]) if(doc.CheckOptions(argc, argv)) { // Construct and print requested documentation. - std::vector<cmDocumentationEntry> commands; cmCTestScriptHandler* ch = static_cast<cmCTestScriptHandler*>(inst.GetHandler("script")); ch->CreateCMake(); - ch->GetCommandDocumentation(commands); doc.SetShowGenerators(false); doc.SetName("ctest"); doc.SetSection("Name",cmDocumentationName); doc.SetSection("Usage",cmDocumentationUsage); - doc.SetSection("Description",cmDocumentationDescription); doc.PrependSection("Options",cmDocumentationOptions); - doc.SetSection("Commands",commands); - doc.SetSeeAlsoList(cmDocumentationSeeAlso); #ifdef cout # undef cout #endif |