From f29e2292c90d4fbdadce041b1c9d649aca3c602b Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 8 Nov 2018 09:27:28 -0500 Subject: cpack: When given an unknown generator print out all valid generators This makes cpack behavior match cmake when passed an invalid generator --- Source/CPack/cpack.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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 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; } -- cgit v0.12