[Cmake-commits] CMake branch, next, updated. v3.7.0-rc1-410-g7151a2f

Brad King brad.king at kitware.com
Wed Oct 12 08:58:42 EDT 2016


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  7151a2f464b03bf024dca0165678299ca35e8c6c (commit)
       via  5380948faec94270f9b799fba6f8b0e7c9ad0899 (commit)
       via  1aee54ed87f94ceb91fb6c9693160fa41313b7ca (commit)
       via  24c86e1c3ff5b507815e081f2173bc5b77358e78 (commit)
       via  6db64ad43202af66270d996775e1504ba676b63d (commit)
       via  d3df00ae5330de935eafd0f315017ae0f89a6968 (commit)
       via  10160f691c5fa6849a02383d727b30da648aa878 (commit)
       via  0838d20e506ed6bf064b51f7ef2d026c76b4af3d (commit)
       via  8f33de92ba4fc152b0e2b63008732ce0ad4ba18c (commit)
      from  3a087b7b57b8d3625655930b086588cfc14c3829 (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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7151a2f464b03bf024dca0165678299ca35e8c6c
commit 7151a2f464b03bf024dca0165678299ca35e8c6c
Merge: 3a087b7 5380948
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Oct 12 08:58:38 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Oct 12 08:58:38 2016 -0400

    Merge topic 'vs-default-generator' into next
    
    5380948f cmake: Fix default VS generator selection for Microsoft Build Tools
    1aee54ed cmake: Simplify default generator search by switching direction
    24c86e1c cmake: Use array iteration for default generator VS variants
    6db64ad4 cmake: Use array iteration for default generator list
    d3df00ae cmake: Rename default generator selection list variable
    10160f69 cmake: Rename default generator selection internal variable
    0838d20e cmake: Simplify VS registry entry lookup
    8f33de92 cmake: Factor out default generator selection into helper


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5380948faec94270f9b799fba6f8b0e7c9ad0899
commit 5380948faec94270f9b799fba6f8b0e7c9ad0899
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Oct 11 13:36:41 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Oct 11 13:39:58 2016 -0400

    cmake: Fix default VS generator selection for Microsoft Build Tools
    
    Some versions of the VS tools do not install the registry entry
    
        HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\$v;InstallDir
    
    but all appear to set
    
        HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\$v\Setup\VC;ProductDir
    
    Update our search to consider both entries.
    
    Closes: #16360

diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 78f8c48..b4ab42e 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1467,17 +1467,23 @@ void cmake::CreateDefaultGlobalGenerator()
     { "8.0", "Visual Studio 8 2005" },   //
     { "7.1", "Visual Studio 7 .NET 2003" }
   };
+  static const char* const vsEntries[] = {
+    "\\Setup\\VC;ProductDir", //
+    ";InstallDir"             //
+  };
   for (VSVersionedGenerator const* g = cmArrayBegin(vsGenerators);
        found.empty() && g != cmArrayEnd(vsGenerators); ++g) {
     for (const char* const* v = cmArrayBegin(vsVariants);
          found.empty() && v != cmArrayEnd(vsVariants); ++v) {
-      std::string reg = vsregBase + *v + g->MSVersion;
-      reg += ";InstallDir";
-      std::string dir;
-      if (cmSystemTools::ReadRegistryValue(reg, dir,
-                                           cmSystemTools::KeyWOW64_32) &&
-          cmSystemTools::PathExists(dir)) {
-        found = g->GeneratorName;
+      for (const char* const* e = cmArrayBegin(vsEntries);
+           found.empty() && e != cmArrayEnd(vsEntries); ++e) {
+        std::string const reg = vsregBase + *v + g->MSVersion + *e;
+        std::string dir;
+        if (cmSystemTools::ReadRegistryValue(reg, dir,
+                                             cmSystemTools::KeyWOW64_32) &&
+            cmSystemTools::PathExists(dir)) {
+          found = g->GeneratorName;
+        }
       }
     }
   }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1aee54ed87f94ceb91fb6c9693160fa41313b7ca
commit 1aee54ed87f94ceb91fb6c9693160fa41313b7ca
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Oct 11 13:29:37 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Oct 11 13:32:33 2016 -0400

    cmake: Simplify default generator search by switching direction
    
    Search from newest to oldest and stop once found.

diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 96a7b9a..78f8c48 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1458,20 +1458,19 @@ void cmake::CreateDefaultGlobalGenerator()
     const char* GeneratorName;
   };
   static VSVersionedGenerator const vsGenerators[] = {
-    /* clang-format needs this comment to break after the opening brace */
-    { "7.1", "Visual Studio 7 .NET 2003" },
-    { "8.0", "Visual Studio 8 2005" },
-    { "9.0", "Visual Studio 9 2008" },
-    { "10.0", "Visual Studio 10 2010" },
-    { "11.0", "Visual Studio 11 2012" },
-    { "12.0", "Visual Studio 12 2013" },
-    { "14.0", "Visual Studio 14 2015" },
-    { "15.0", "Visual Studio 15" }
+    { "15.0", "Visual Studio 15" },      //
+    { "14.0", "Visual Studio 14 2015" }, //
+    { "12.0", "Visual Studio 12 2013" }, //
+    { "11.0", "Visual Studio 11 2012" }, //
+    { "10.0", "Visual Studio 10 2010" }, //
+    { "9.0", "Visual Studio 9 2008" },   //
+    { "8.0", "Visual Studio 8 2005" },   //
+    { "7.1", "Visual Studio 7 .NET 2003" }
   };
   for (VSVersionedGenerator const* g = cmArrayBegin(vsGenerators);
-       g != cmArrayEnd(vsGenerators); ++g) {
+       found.empty() && g != cmArrayEnd(vsGenerators); ++g) {
     for (const char* const* v = cmArrayBegin(vsVariants);
-         v != cmArrayEnd(vsVariants); ++v) {
+         found.empty() && v != cmArrayEnd(vsVariants); ++v) {
       std::string reg = vsregBase + *v + g->MSVersion;
       reg += ";InstallDir";
       std::string dir;
@@ -1479,7 +1478,6 @@ void cmake::CreateDefaultGlobalGenerator()
                                            cmSystemTools::KeyWOW64_32) &&
           cmSystemTools::PathExists(dir)) {
         found = g->GeneratorName;
-        break;
       }
     }
   }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=24c86e1c3ff5b507815e081f2173bc5b77358e78
commit 24c86e1c3ff5b507815e081f2173bc5b77358e78
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Oct 11 13:14:26 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Oct 11 13:19:01 2016 -0400

    cmake: Use array iteration for default generator VS variants

diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 6ffa308..96a7b9a 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1448,10 +1448,10 @@ void cmake::CreateDefaultGlobalGenerator()
   // Try to find the newest VS installed on the computer and
   // use that as a default if -G is not specified
   const std::string vsregBase = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\";
-  std::vector<std::string> vsVerions;
-  vsVerions.push_back("VisualStudio\\");
-  vsVerions.push_back("VCExpress\\");
-  vsVerions.push_back("WDExpress\\");
+  static const char* const vsVariants[] = {
+    /* clang-format needs this comment to break after the opening brace */
+    "VisualStudio\\", "VCExpress\\", "WDExpress\\"
+  };
   struct VSVersionedGenerator
   {
     const char* MSVersion;
@@ -1470,8 +1470,9 @@ void cmake::CreateDefaultGlobalGenerator()
   };
   for (VSVersionedGenerator const* g = cmArrayBegin(vsGenerators);
        g != cmArrayEnd(vsGenerators); ++g) {
-    for (size_t b = 0; b < vsVerions.size(); b++) {
-      std::string reg = vsregBase + vsVerions[b] + g->MSVersion;
+    for (const char* const* v = cmArrayBegin(vsVariants);
+         v != cmArrayEnd(vsVariants); ++v) {
+      std::string reg = vsregBase + *v + g->MSVersion;
       reg += ";InstallDir";
       std::string dir;
       if (cmSystemTools::ReadRegistryValue(reg, dir,

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6db64ad43202af66270d996775e1504ba676b63d
commit 6db64ad43202af66270d996775e1504ba676b63d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Oct 11 13:09:38 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Oct 11 13:17:48 2016 -0400

    cmake: Use array iteration for default generator list

diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index d74b7c1..6ffa308 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1466,18 +1466,18 @@ void cmake::CreateDefaultGlobalGenerator()
     { "11.0", "Visual Studio 11 2012" },
     { "12.0", "Visual Studio 12 2013" },
     { "14.0", "Visual Studio 14 2015" },
-    { "15.0", "Visual Studio 15" },
-    { 0, 0 }
+    { "15.0", "Visual Studio 15" }
   };
-  for (int i = 0; vsGenerators[i].MSVersion != 0; i++) {
+  for (VSVersionedGenerator const* g = cmArrayBegin(vsGenerators);
+       g != cmArrayEnd(vsGenerators); ++g) {
     for (size_t b = 0; b < vsVerions.size(); b++) {
-      std::string reg = vsregBase + vsVerions[b] + vsGenerators[i].MSVersion;
+      std::string reg = vsregBase + vsVerions[b] + g->MSVersion;
       reg += ";InstallDir";
       std::string dir;
       if (cmSystemTools::ReadRegistryValue(reg, dir,
                                            cmSystemTools::KeyWOW64_32) &&
           cmSystemTools::PathExists(dir)) {
-        found = vsGenerators[i].GeneratorName;
+        found = g->GeneratorName;
         break;
       }
     }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d3df00ae5330de935eafd0f315017ae0f89a6968
commit d3df00ae5330de935eafd0f315017ae0f89a6968
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Oct 11 13:06:58 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Oct 11 13:16:24 2016 -0400

    cmake: Rename default generator selection list variable

diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index ed4d453..d74b7c1 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1452,12 +1452,12 @@ void cmake::CreateDefaultGlobalGenerator()
   vsVerions.push_back("VisualStudio\\");
   vsVerions.push_back("VCExpress\\");
   vsVerions.push_back("WDExpress\\");
-  struct VSRegistryEntryName
+  struct VSVersionedGenerator
   {
     const char* MSVersion;
     const char* GeneratorName;
   };
-  VSRegistryEntryName version[] = {
+  static VSVersionedGenerator const vsGenerators[] = {
     /* clang-format needs this comment to break after the opening brace */
     { "7.1", "Visual Studio 7 .NET 2003" },
     { "8.0", "Visual Studio 8 2005" },
@@ -1469,15 +1469,15 @@ void cmake::CreateDefaultGlobalGenerator()
     { "15.0", "Visual Studio 15" },
     { 0, 0 }
   };
-  for (int i = 0; version[i].MSVersion != 0; i++) {
+  for (int i = 0; vsGenerators[i].MSVersion != 0; i++) {
     for (size_t b = 0; b < vsVerions.size(); b++) {
-      std::string reg = vsregBase + vsVerions[b] + version[i].MSVersion;
+      std::string reg = vsregBase + vsVerions[b] + vsGenerators[i].MSVersion;
       reg += ";InstallDir";
       std::string dir;
       if (cmSystemTools::ReadRegistryValue(reg, dir,
                                            cmSystemTools::KeyWOW64_32) &&
           cmSystemTools::PathExists(dir)) {
-        found = version[i].GeneratorName;
+        found = vsGenerators[i].GeneratorName;
         break;
       }
     }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=10160f691c5fa6849a02383d727b30da648aa878
commit 10160f691c5fa6849a02383d727b30da648aa878
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Oct 11 11:50:56 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Oct 11 11:50:56 2016 -0400

    cmake: Rename default generator selection internal variable

diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index be08fc7..ed4d453 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1444,7 +1444,7 @@ int cmake::ActualConfigure()
 void cmake::CreateDefaultGlobalGenerator()
 {
 #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW)
-  std::string installedCompiler;
+  std::string found;
   // Try to find the newest VS installed on the computer and
   // use that as a default if -G is not specified
   const std::string vsregBase = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\";
@@ -1477,13 +1477,12 @@ void cmake::CreateDefaultGlobalGenerator()
       if (cmSystemTools::ReadRegistryValue(reg, dir,
                                            cmSystemTools::KeyWOW64_32) &&
           cmSystemTools::PathExists(dir)) {
-        installedCompiler = version[i].GeneratorName;
+        found = version[i].GeneratorName;
         break;
       }
     }
   }
-  cmGlobalGenerator* gen =
-    this->CreateGlobalGenerator(installedCompiler.c_str());
+  cmGlobalGenerator* gen = this->CreateGlobalGenerator(found);
   if (!gen) {
     gen = new cmGlobalNMakeMakefileGenerator(this);
   }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0838d20e506ed6bf064b51f7ef2d026c76b4af3d
commit 0838d20e506ed6bf064b51f7ef2d026c76b4af3d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Oct 11 11:35:49 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Oct 11 11:46:45 2016 -0400

    cmake: Simplify VS registry entry lookup

diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 3bf7f38..be08fc7 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1447,7 +1447,7 @@ void cmake::CreateDefaultGlobalGenerator()
   std::string installedCompiler;
   // Try to find the newest VS installed on the computer and
   // use that as a default if -G is not specified
-  const std::string vsregBase = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\";
+  const std::string vsregBase = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\";
   std::vector<std::string> vsVerions;
   vsVerions.push_back("VisualStudio\\");
   vsVerions.push_back("VCExpress\\");
@@ -1472,9 +1472,11 @@ void cmake::CreateDefaultGlobalGenerator()
   for (int i = 0; version[i].MSVersion != 0; i++) {
     for (size_t b = 0; b < vsVerions.size(); b++) {
       std::string reg = vsregBase + vsVerions[b] + version[i].MSVersion;
-      reg += ";InstallDir]";
-      cmSystemTools::ExpandRegistryValues(reg, cmSystemTools::KeyWOW64_32);
-      if (!(reg == "/registry")) {
+      reg += ";InstallDir";
+      std::string dir;
+      if (cmSystemTools::ReadRegistryValue(reg, dir,
+                                           cmSystemTools::KeyWOW64_32) &&
+          cmSystemTools::PathExists(dir)) {
         installedCompiler = version[i].GeneratorName;
         break;
       }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8f33de92ba4fc152b0e2b63008732ce0ad4ba18c
commit 8f33de92ba4fc152b0e2b63008732ce0ad4ba18c
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Oct 11 11:25:28 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Oct 11 11:30:46 2016 -0400

    cmake: Factor out default generator selection into helper

diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index e0f4000..3bf7f38 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1313,54 +1313,7 @@ int cmake::ActualConfigure()
       cmSystemTools::SetForceUnixPaths(
         this->GlobalGenerator->GetForceUnixPaths());
     } else {
-#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW)
-      std::string installedCompiler;
-      // Try to find the newest VS installed on the computer and
-      // use that as a default if -G is not specified
-      const std::string vsregBase =
-        "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\";
-      std::vector<std::string> vsVerions;
-      vsVerions.push_back("VisualStudio\\");
-      vsVerions.push_back("VCExpress\\");
-      vsVerions.push_back("WDExpress\\");
-      struct VSRegistryEntryName
-      {
-        const char* MSVersion;
-        const char* GeneratorName;
-      };
-      VSRegistryEntryName version[] = {
-        /* clang-format needs this comment to break after the opening brace */
-        { "7.1", "Visual Studio 7 .NET 2003" },
-        { "8.0", "Visual Studio 8 2005" },
-        { "9.0", "Visual Studio 9 2008" },
-        { "10.0", "Visual Studio 10 2010" },
-        { "11.0", "Visual Studio 11 2012" },
-        { "12.0", "Visual Studio 12 2013" },
-        { "14.0", "Visual Studio 14 2015" },
-        { "15.0", "Visual Studio 15" },
-        { 0, 0 }
-      };
-      for (int i = 0; version[i].MSVersion != 0; i++) {
-        for (size_t b = 0; b < vsVerions.size(); b++) {
-          std::string reg = vsregBase + vsVerions[b] + version[i].MSVersion;
-          reg += ";InstallDir]";
-          cmSystemTools::ExpandRegistryValues(reg, cmSystemTools::KeyWOW64_32);
-          if (!(reg == "/registry")) {
-            installedCompiler = version[i].GeneratorName;
-            break;
-          }
-        }
-      }
-      cmGlobalGenerator* gen =
-        this->CreateGlobalGenerator(installedCompiler.c_str());
-      if (!gen) {
-        gen = new cmGlobalNMakeMakefileGenerator(this);
-      }
-      this->SetGlobalGenerator(gen);
-      std::cout << "-- Building for: " << gen->GetName() << "\n";
-#else
-      this->SetGlobalGenerator(new cmGlobalUnixMakefileGenerator3(this));
-#endif
+      this->CreateDefaultGlobalGenerator();
     }
     if (!this->GlobalGenerator) {
       cmSystemTools::Error("Could not create generator");
@@ -1488,6 +1441,57 @@ int cmake::ActualConfigure()
   return 0;
 }
 
+void cmake::CreateDefaultGlobalGenerator()
+{
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW)
+  std::string installedCompiler;
+  // Try to find the newest VS installed on the computer and
+  // use that as a default if -G is not specified
+  const std::string vsregBase = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\";
+  std::vector<std::string> vsVerions;
+  vsVerions.push_back("VisualStudio\\");
+  vsVerions.push_back("VCExpress\\");
+  vsVerions.push_back("WDExpress\\");
+  struct VSRegistryEntryName
+  {
+    const char* MSVersion;
+    const char* GeneratorName;
+  };
+  VSRegistryEntryName version[] = {
+    /* clang-format needs this comment to break after the opening brace */
+    { "7.1", "Visual Studio 7 .NET 2003" },
+    { "8.0", "Visual Studio 8 2005" },
+    { "9.0", "Visual Studio 9 2008" },
+    { "10.0", "Visual Studio 10 2010" },
+    { "11.0", "Visual Studio 11 2012" },
+    { "12.0", "Visual Studio 12 2013" },
+    { "14.0", "Visual Studio 14 2015" },
+    { "15.0", "Visual Studio 15" },
+    { 0, 0 }
+  };
+  for (int i = 0; version[i].MSVersion != 0; i++) {
+    for (size_t b = 0; b < vsVerions.size(); b++) {
+      std::string reg = vsregBase + vsVerions[b] + version[i].MSVersion;
+      reg += ";InstallDir]";
+      cmSystemTools::ExpandRegistryValues(reg, cmSystemTools::KeyWOW64_32);
+      if (!(reg == "/registry")) {
+        installedCompiler = version[i].GeneratorName;
+        break;
+      }
+    }
+  }
+  cmGlobalGenerator* gen =
+    this->CreateGlobalGenerator(installedCompiler.c_str());
+  if (!gen) {
+    gen = new cmGlobalNMakeMakefileGenerator(this);
+  }
+  this->SetGlobalGenerator(gen);
+  std::cout << "-- Building for: " << gen->GetName() << "\n";
+#else
+  this->SetGlobalGenerator(new cmGlobalUnixMakefileGenerator3(this));
+#endif
+}
+
 void cmake::PreLoadCMakeFiles()
 {
   std::vector<std::string> args;
diff --git a/Source/cmake.h b/Source/cmake.h
index ae1a502..865748b 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -500,6 +500,8 @@ private:
   // Print a list of valid generators to stderr.
   void PrintGeneratorList();
 
+  void CreateDefaultGlobalGenerator();
+
   /**
    * Convert a message type between a warning and an error, based on the state
    * of the error output CMake variables, in the cache.

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

Summary of changes:
 Source/cmake.cxx |  106 +++++++++++++++++++++++++++++-------------------------
 Source/cmake.h   |    2 ++
 2 files changed, 60 insertions(+), 48 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list