From 2a8b05b69d2db9b4c24db73f8e5a662747ec312b Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 27 Jul 2004 13:40:47 -0400 Subject: [PATCH] BUG: fix for bug 971, pick a better generator from the command line --- Source/cmake.cxx | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index a90356ce7..de6aebf14 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1032,7 +1032,41 @@ int cmake::Configure() #if defined(__BORLANDC__) && defined(_WIN32) this->SetGlobalGenerator(new cmGlobalBorlandMakefileGenerator); #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 this->SetGlobalGenerator(new cmGlobalUnixMakefileGenerator); #endif