summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-10-11 17:29:37 (GMT)
committerBrad King <brad.king@kitware.com>2016-10-11 17:32:33 (GMT)
commit1aee54ed87f94ceb91fb6c9693160fa41313b7ca (patch)
tree2a6c72f364c291c6b8d7e9fc9c97de4df65a95a7 /Source
parent24c86e1c3ff5b507815e081f2173bc5b77358e78 (diff)
downloadCMake-1aee54ed87f94ceb91fb6c9693160fa41313b7ca.zip
CMake-1aee54ed87f94ceb91fb6c9693160fa41313b7ca.tar.gz
CMake-1aee54ed87f94ceb91fb6c9693160fa41313b7ca.tar.bz2
cmake: Simplify default generator search by switching direction
Search from newest to oldest and stop once found.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmake.cxx22
1 files changed, 10 insertions, 12 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 96a7b9a..78f8c48 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1458,20 +1458,19 @@ void cmake::CreateDefaultGlobalGenerator()
const char* GeneratorName;
};
static VSVersionedGenerator const vsGenerators[] = {
- /* clang-format needs this comment to break after the opening brace */
- { "7.1", "Visual Studio 7 .NET 2003" },
- { "8.0", "Visual Studio 8 2005" },
- { "9.0", "Visual Studio 9 2008" },
- { "10.0", "Visual Studio 10 2010" },
- { "11.0", "Visual Studio 11 2012" },
- { "12.0", "Visual Studio 12 2013" },
- { "14.0", "Visual Studio 14 2015" },
- { "15.0", "Visual Studio 15" }
+ { "15.0", "Visual Studio 15" }, //
+ { "14.0", "Visual Studio 14 2015" }, //
+ { "12.0", "Visual Studio 12 2013" }, //
+ { "11.0", "Visual Studio 11 2012" }, //
+ { "10.0", "Visual Studio 10 2010" }, //
+ { "9.0", "Visual Studio 9 2008" }, //
+ { "8.0", "Visual Studio 8 2005" }, //
+ { "7.1", "Visual Studio 7 .NET 2003" }
};
for (VSVersionedGenerator const* g = cmArrayBegin(vsGenerators);
- g != cmArrayEnd(vsGenerators); ++g) {
+ found.empty() && g != cmArrayEnd(vsGenerators); ++g) {
for (const char* const* v = cmArrayBegin(vsVariants);
- v != cmArrayEnd(vsVariants); ++v) {
+ found.empty() && v != cmArrayEnd(vsVariants); ++v) {
std::string reg = vsregBase + *v + g->MSVersion;
reg += ";InstallDir";
std::string dir;
@@ -1479,7 +1478,6 @@ void cmake::CreateDefaultGlobalGenerator()
cmSystemTools::KeyWOW64_32) &&
cmSystemTools::PathExists(dir)) {
found = g->GeneratorName;
- break;
}
}
}