[cmake-commits] hoffman committed CMakeGenDialog.cpp 1.1 1.2

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Sep 25 11:01:38 EDT 2007


Update of /cvsroot/CMake/CMake/Source/MFCDialog
In directory public:/mounts/ram/cvs-serv7101

Modified Files:
	CMakeGenDialog.cpp 
Log Message:
ENH: more generic search for visual studio installations


Index: CMakeGenDialog.cpp
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/MFCDialog/CMakeGenDialog.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CMakeGenDialog.cpp	28 Mar 2005 18:23:07 -0000	1.1
+++ CMakeGenDialog.cpp	25 Sep 2007 15:01:36 -0000	1.2
@@ -69,48 +69,41 @@
   bool done = false;
   
   // is the last generator set? If so use it
-  mp = "[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;LastGenerator]";
+  mp = "[HKEY_CURRENT_USER\\Software\\Kitware"
+    "\\CMakeSetup\\Settings\\StartPath;LastGenerator]";
   cmSystemTools::ExpandRegistryValues(mp);
   if(mp != "/registry")
     {
     m_GeneratorChoiceString = mp.c_str();
     done = true;
     }
-
-  // look for VS8
-  if (!done)
+  struct regToGen
+  {
+    const char* Registry;
+    const char* GeneratorName;
+  };
+  regToGen installedGenerators[] = {
+    // VS 9
+    { "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft"
+      "\\VisualStudio\\9.0\\Setup;Dbghelp_path]", "Visual Studio 9 2008"},
+    // VS 8
+    { "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft"
+      "\\VisualStudio\\8.0\\Setup;Dbghelp_path]", "Visual Studio 8 2005"},
+    // VS 7.1
+    {"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft"
+     "\\VisualStudio\\7.1;InstallDir]", "Visual Studio 7 .NET 2003"},
+    // VS 7
+    {"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft"
+     "\\VisualStudio\\7.0;InstallDir]", "Visual Studio 7"},
+    {0,0}
+  };
+  for(regToGen* ptr = installedGenerators; ptr->Registry != 0 && !done; ptr++)
     {
-    // check for vs8 in registry then decide what default to use
-    mp = 
-      "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup;Dbghelp_path]";
+    mp = ptr->Registry;
     cmSystemTools::ExpandRegistryValues(mp);
     if(mp != "/registry")
       {
-      m_GeneratorChoiceString = "Visual Studio 8 2005";
-      done = true;
-      }
-    }
-  
-  // look for VS7.1
-  if (!done)
-    {
-    mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1;InstallDir]";
-    cmSystemTools::ExpandRegistryValues(mp);
-    if (mp != "/registry")
-      {
-      m_GeneratorChoiceString = "Visual Studio 7 .NET 2003";
-      done = true;
-      }
-    }
-  
-  // look for VS7
-  if (!done)
-    {
-    mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.0;InstallDir]";
-    cmSystemTools::ExpandRegistryValues(mp);
-    if (mp != "/registry")
-      {
-      m_GeneratorChoiceString = "Visual Studio 7";
+      m_GeneratorChoiceString = ptr->GeneratorName;
       done = true;
       }
     }



More information about the Cmake-commits mailing list