diff options
author | Clinton Stimpson <clinton@elemtech.com> | 2007-11-27 06:04:02 (GMT) |
---|---|---|
committer | Clinton Stimpson <clinton@elemtech.com> | 2007-11-27 06:04:02 (GMT) |
commit | 86126dc41f85196b034b5e767fdc5b1e5b7d9d5d (patch) | |
tree | 53dd793baa32c5674ff41e2944e8399b4db7f6c2 /Source/QtDialog | |
parent | 9b2f9500617b509c8d12d7fb81d1c726ec59b2a9 (diff) | |
download | CMake-86126dc41f85196b034b5e767fdc5b1e5b7d9d5d.zip CMake-86126dc41f85196b034b5e767fdc5b1e5b7d9d5d.tar.gz CMake-86126dc41f85196b034b5e767fdc5b1e5b7d9d5d.tar.bz2 |
ENH: Add handling of --help and related arguments.
Diffstat (limited to 'Source/QtDialog')
-rw-r--r-- | Source/QtDialog/CMakeSetup.cxx | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 1f6b340..c7f5f54 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -20,6 +20,44 @@ #include <QDir> #include "CMakeSetupDialog.h" +#include "cmDocumentation.h" +#include "cmake.h" + +//---------------------------------------------------------------------------- +static const char * cmDocumentationName[][3] = +{ + {0, + " CMakeSetup - CMake GUI.", 0}, + {0,0,0} +}; + +//---------------------------------------------------------------------------- +static const char * cmDocumentationUsage[][3] = +{ + {0, + " CMakeSetup [options]\n" + " CMakeSetup [options] <path-to-source>\n" + " CMakeSetup [options] <path-to-existing-build>", 0}, + {0,0,0} +}; + +//---------------------------------------------------------------------------- +static const char * cmDocumentationDescription[][3] = +{ + {0, + "The \"CMakeSetup\" 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} +}; int main(int argc, char** argv) { @@ -27,6 +65,36 @@ int main(int argc, char** argv) app.setApplicationName("CMakeSetup"); app.setOrganizationName("Kitware"); app.setWindowIcon(QIcon(":/Icons/CMakeSetup.png")); + + cmDocumentation doc; + if(app.arguments().size() > 1 && + doc.CheckOptions(app.argc(), app.argv())) + { + // Construct and print requested documentation. + cmake hcm; + hcm.AddCMakePaths(app.argv()[0]); + doc.SetCMakeRoot(hcm.GetCacheDefinition("CMAKE_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); + } CMakeSetupDialog dialog; dialog.setWindowTitle("CMakeSetup"); |