[Cmake-commits] CMake branch, next, updated. v3.2.1-1726-gf9b2ab2

Brad King brad.king at kitware.com
Fri Apr 10 14:59:21 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  f9b2ab214fb8041b3c8741e72f73a7bc360d3727 (commit)
       via  d4e3882abbf16e862743ffe20af3f183b1806956 (commit)
      from  27d475ce6dec85fe6c3ce108cc859608fd1bd3ac (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f9b2ab214fb8041b3c8741e72f73a7bc360d3727
commit f9b2ab214fb8041b3c8741e72f73a7bc360d3727
Merge: 27d475c d4e3882
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Apr 10 14:59:20 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Apr 10 14:59:20 2015 -0400

    Merge topic 'cmake-G-print-generators' into next
    
    d4e3882a cmake: Provide guidance when an invalid -G option is given

diff --cc Source/cmake.h
index bbeb95d,0715d74..c8d46b6
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@@ -480,9 -475,10 +480,12 @@@ private
    std::vector<std::string> DebugConfigs;
    InstalledFilesMap InstalledFiles;
  
 +  cmState* State;
 +
    void UpdateConversionPathTable();
+ 
+   // Print a list of valid generators to stderr.
+   void PrintGeneratorList();
  };
  
  #define CMAKE_STANDARD_OPTIONS_TABLE \

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d4e3882abbf16e862743ffe20af3f183b1806956
commit d4e3882abbf16e862743ffe20af3f183b1806956
Author:     Gerald Combs <gerald at wireshark.org>
AuthorDate: Sun Mar 29 11:28:30 2015 -0700
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Apr 10 14:57:06 2015 -0400

    cmake: Provide guidance when an invalid -G option is given
    
    Print a list of generators if no generator or an invalid one is
    supplied.
    
    Signed-off-by: Gerald Combs <gerald at wireshark.org>

diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 8c17536..4f34755 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -138,6 +138,8 @@ bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os)
       return this->PrintHelpListVariables(os);
     case cmDocumentation::ListPolicies:
       return this->PrintHelpListPolicies(os);
+    case cmDocumentation::ListGenerators:
+      return this->PrintHelpListGenerators(os);
     case cmDocumentation::Version:
       return this->PrintVersion(os);
     case cmDocumentation::OldCustomModules:
@@ -817,6 +819,19 @@ bool cmDocumentation::PrintHelpListPolicies(std::ostream& os)
 }
 
 //----------------------------------------------------------------------------
+bool cmDocumentation::PrintHelpListGenerators(std::ostream& os)
+{
+  std::map<std::string,cmDocumentationSection*>::iterator si;
+  si = this->AllSections.find("Generators");
+  if(si != this->AllSections.end())
+    {
+    this->Formatter.SetIndent("  ");
+    this->Formatter.PrintSection(os, *si->second);
+    }
+  return true;
+}
+
+//----------------------------------------------------------------------------
 bool cmDocumentation::PrintHelpOneVariable(std::ostream& os)
 {
   std::string vname = cmSystemTools::HelpFileName(this->CurrentArgument);
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index b72b5fe..8854c36 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -117,6 +117,7 @@ private:
   bool PrintHelpListProperties(std::ostream& os);
   bool PrintHelpListVariables(std::ostream& os);
   bool PrintHelpListPolicies(std::ostream& os);
+  bool PrintHelpListGenerators(std::ostream& os);
   bool PrintOldCustomModules(std::ostream& os);
 
   const char* GetNameString() const;
diff --git a/Source/cmDocumentationFormatter.h b/Source/cmDocumentationFormatter.h
index 59513cc..6e19b7d 100644
--- a/Source/cmDocumentationFormatter.h
+++ b/Source/cmDocumentationFormatter.h
@@ -26,8 +26,8 @@ public:
   /** Types of help provided.  */
   enum Type
   {
-    None, Version, Usage, Help, Full, ListManuals,
-    ListCommands, ListModules, ListProperties, ListVariables, ListPolicies,
+    None, Version, Usage, Help, Full, ListManuals, ListCommands,
+    ListModules, ListProperties, ListVariables, ListPolicies, ListGenerators,
     OneManual, OneCommand, OneModule, OneProperty, OneVariable, OnePolicy,
     OldCustomModules
   };
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 7595155..6d75e29 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -818,6 +818,7 @@ void cmake::SetArgs(const std::vector<std::string>& args,
         if(i >= args.size())
           {
           cmSystemTools::Error("No generator specified for -G");
+          this->PrintGeneratorList();
           return;
           }
         value = args[i];
@@ -828,6 +829,7 @@ void cmake::SetArgs(const std::vector<std::string>& args,
         {
         cmSystemTools::Error("Could not create named generator ",
                              value.c_str());
+        this->PrintGeneratorList();
         }
       else
         {
@@ -1961,6 +1963,16 @@ void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
     }
 }
 
+void cmake::PrintGeneratorList()
+{
+  cmDocumentation doc;
+  std::vector<cmDocumentationEntry> generators;
+  this->GetGeneratorDocumentation(generators);
+  doc.AppendSection("Generators",generators);
+  std::cerr << "\n";
+  doc.PrintDocumentation(cmDocumentation::ListGenerators, std::cerr);
+}
+
 void cmake::UpdateConversionPathTable()
 {
   // Update the path conversion table with any specified file:
@@ -2438,6 +2450,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
         if(i >= args.size())
           {
           cmSystemTools::Error("No generator specified for -G");
+          this->PrintGeneratorList();
           return -1;
           }
         value = args[i];
@@ -2448,6 +2461,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
         {
         cmSystemTools::Error("Could not create named generator ",
                              value.c_str());
+        this->PrintGeneratorList();
         }
       else
         {
diff --git a/Source/cmake.h b/Source/cmake.h
index 3acf4a8..0715d74 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -476,6 +476,9 @@ private:
   InstalledFilesMap InstalledFiles;
 
   void UpdateConversionPathTable();
+
+  // Print a list of valid generators to stderr.
+  void PrintGeneratorList();
 };
 
 #define CMAKE_STANDARD_OPTIONS_TABLE \
diff --git a/Tests/RunCMake/CommandLine/G_bad-arg-stderr.txt b/Tests/RunCMake/CommandLine/G_bad-arg-stderr.txt
index 511208f..07f2b52 100644
--- a/Tests/RunCMake/CommandLine/G_bad-arg-stderr.txt
+++ b/Tests/RunCMake/CommandLine/G_bad-arg-stderr.txt
@@ -1 +1,3 @@
-^CMake Error: Could not create named generator NoSuchGenerator$
+^CMake Error: Could not create named generator NoSuchGenerator
+
+Generators
diff --git a/Tests/RunCMake/CommandLine/G_no-arg-stderr.txt b/Tests/RunCMake/CommandLine/G_no-arg-stderr.txt
index 56d23c2..2f491a2 100644
--- a/Tests/RunCMake/CommandLine/G_no-arg-stderr.txt
+++ b/Tests/RunCMake/CommandLine/G_no-arg-stderr.txt
@@ -1 +1,3 @@
-^CMake Error: No generator specified for -G$
+^CMake Error: No generator specified for -G
+
+Generators

-----------------------------------------------------------------------

Summary of changes:
 Source/cmDocumentation.cxx                      |   15 +++++++++++++++
 Source/cmDocumentation.h                        |    1 +
 Source/cmDocumentationFormatter.h               |    4 ++--
 Source/cmake.cxx                                |   14 ++++++++++++++
 Source/cmake.h                                  |    3 +++
 Tests/RunCMake/CommandLine/G_bad-arg-stderr.txt |    4 +++-
 Tests/RunCMake/CommandLine/G_no-arg-stderr.txt  |    4 +++-
 7 files changed, 41 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list