Merge topic 'find-vcexpress'

de28946 Find VC Express during default generator selection (#12917)
This commit is contained in:
David Cole 2012-02-07 15:33:23 -05:00 committed by CMake Topic Stage
commit 941d533cc3
1 changed files with 15 additions and 8 deletions

View File

@ -2204,8 +2204,11 @@ int cmake::ActualConfigure()
std::string installedCompiler; std::string installedCompiler;
// Try to find the newest VS installed on the computer and // Try to find the newest VS installed on the computer and
// use that as a default if -G is not specified // use that as a default if -G is not specified
std::string vsregBase = const std::string vsregBase =
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\"; "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\";
std::vector<std::string> vsVerions;
vsVerions.push_back("VisualStudio\\");
vsVerions.push_back("VCExpress\\");
struct VSRegistryEntryName struct VSRegistryEntryName
{ {
const char* MSVersion; const char* MSVersion;
@ -2219,14 +2222,18 @@ int cmake::ActualConfigure()
{"9.0", "Visual Studio 9 2008"}, {"9.0", "Visual Studio 9 2008"},
{"10.0", "Visual Studio 10"}, {"10.0", "Visual Studio 10"},
{0, 0}}; {0, 0}};
for(int i =0; version[i].MSVersion != 0; i++) for(size_t b=0; b < vsVerions.size() && installedCompiler.empty(); b++)
{ {
std::string reg = vsregBase + version[i].MSVersion; for(int i =0; version[i].MSVersion != 0; i++)
reg += ";InstallDir]";
cmSystemTools::ExpandRegistryValues(reg);
if (!(reg == "/registry"))
{ {
installedCompiler = version[i].GeneratorName; std::string reg = vsregBase + vsVerions[b] + version[i].MSVersion;
reg += ";InstallDir]";
cmSystemTools::ExpandRegistryValues(reg,
cmSystemTools::KeyWOW64_32);
if (!(reg == "/registry"))
{
installedCompiler = version[i].GeneratorName;
}
} }
} }
cmGlobalGenerator* gen cmGlobalGenerator* gen