summaryrefslogtreecommitdiffstats
path: root/Source/CPack/cpack.cxx
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2018-11-08 14:27:28 (GMT)
committerBrad King <brad.king@kitware.com>2018-11-09 00:07:24 (GMT)
commitf29e2292c90d4fbdadce041b1c9d649aca3c602b (patch)
treeac3f738f19d08d2b50e42aa764cf40fe7103277a /Source/CPack/cpack.cxx
parenteba7273c203f0698ccd716604cc298b7da1d3ee6 (diff)
downloadCMake-f29e2292c90d4fbdadce041b1c9d649aca3c602b.zip
CMake-f29e2292c90d4fbdadce041b1c9d649aca3c602b.tar.gz
CMake-f29e2292c90d4fbdadce041b1c9d649aca3c602b.tar.bz2
cpack: When given an unknown generator print out all valid generators
This makes cpack behavior match cmake when passed an invalid generator
Diffstat (limited to 'Source/CPack/cpack.cxx')
-rw-r--r--Source/CPack/cpack.cxx15
1 files changed, 14 insertions, 1 deletions
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 3df1b36..7cf69fc 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -21,6 +21,7 @@
#include "cmCPackLog.h"
#include "cmDocumentation.h"
#include "cmDocumentationEntry.h"
+#include "cmDocumentationFormatter.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmStateSnapshot.h"
@@ -360,7 +361,19 @@ int main(int argc, char const* const* argv)
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
"Could not create CPack generator: " << gen
<< std::endl);
-
+ // Print out all the valid generators
+ cmDocumentation generatorDocs;
+ std::vector<cmDocumentationEntry> v;
+ for (auto const& g : generators.GetGeneratorsList()) {
+ cmDocumentationEntry e;
+ e.Name = g.first;
+ e.Brief = g.second;
+ v.push_back(std::move(e));
+ }
+ generatorDocs.SetSection("Generators", v);
+ std::cerr << "\n";
+ generatorDocs.PrintDocumentation(cmDocumentation::ListGenerators,
+ std::cerr);
parsed = 0;
}