Browse Source

BUG: fix for bug 971, pick a better generator from the command line

Bill Hoffman 21 years ago
parent
commit
2a8b05b69d
1 changed files with 35 additions and 1 deletions
  1. 35 1
      Source/cmake.cxx

+ 35 - 1
Source/cmake.cxx

@@ -1032,7 +1032,41 @@ int cmake::Configure()
 #if defined(__BORLANDC__) && defined(_WIN32)
 #if defined(__BORLANDC__) && defined(_WIN32)
       this->SetGlobalGenerator(new cmGlobalBorlandMakefileGenerator);
       this->SetGlobalGenerator(new cmGlobalBorlandMakefileGenerator);
 #elif defined(_WIN32) && !defined(__CYGWIN__)  
 #elif defined(_WIN32) && !defined(__CYGWIN__)  
-      this->SetGlobalGenerator(new cmGlobalVisualStudio6Generator);
+      std::string installedCompiler;
+      std::string mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup;Dbghelp_path";
+      cmSystemTools::ExpandRegistryValues(mp);
+      if (!(mp == "/registry"))
+        {
+        installedCompiler = "Visual Studio 8 2005";
+        }
+      else
+        {
+        mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1;InstallDir]";
+        cmSystemTools::ExpandRegistryValues(mp);
+        if (!(mp == "/registry"))
+          {
+          installedCompiler = "Visual Studio 7 .NET 2003";
+          }
+        else
+          {
+          mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.0;InstallDir]";
+          cmSystemTools::ExpandRegistryValues(mp);
+          if (!(mp == "/registry"))
+            {
+            installedCompiler = "Visual Studio 7";
+            }
+          else
+            {
+            installedCompiler = "Visual Studio 6";
+            }
+          }
+        }
+      cmGlobalGenerator* gen = this->CreateGlobalGenerator(installedCompiler.c_str());
+      if(!gen)
+        {
+        gen = new cmGlobalNMakeMakefileGenerator;
+        }
+      this->SetGlobalGenerator(gen);
 #else
 #else
       this->SetGlobalGenerator(new cmGlobalUnixMakefileGenerator);
       this->SetGlobalGenerator(new cmGlobalUnixMakefileGenerator);
 #endif
 #endif