diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2007-09-25 15:01:36 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2007-09-25 15:01:36 (GMT) |
commit | e9889442cf66036da1768ed49de55d43fd478c13 (patch) | |
tree | 92560b6015be9a5a8e7cf8f95690e89611c0ef56 /Source/MFCDialog/CMakeGenDialog.cpp | |
parent | 9c3ffe2474a1ed0280a35e00ff034b1866d9cec4 (diff) | |
download | CMake-e9889442cf66036da1768ed49de55d43fd478c13.zip CMake-e9889442cf66036da1768ed49de55d43fd478c13.tar.gz CMake-e9889442cf66036da1768ed49de55d43fd478c13.tar.bz2 |
ENH: more generic search for visual studio installations
Diffstat (limited to 'Source/MFCDialog/CMakeGenDialog.cpp')
-rw-r--r-- | Source/MFCDialog/CMakeGenDialog.cpp | 57 |
1 files changed, 25 insertions, 32 deletions
diff --git a/Source/MFCDialog/CMakeGenDialog.cpp b/Source/MFCDialog/CMakeGenDialog.cpp index a72a6d0..e1769b6 100644 --- a/Source/MFCDialog/CMakeGenDialog.cpp +++ b/Source/MFCDialog/CMakeGenDialog.cpp @@ -69,48 +69,41 @@ BOOL CCMakeGenDialog::OnInitDialog() 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; } } |