summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-10-11 17:14:26 (GMT)
committerBrad King <brad.king@kitware.com>2016-10-11 17:19:01 (GMT)
commit24c86e1c3ff5b507815e081f2173bc5b77358e78 (patch)
tree983668961ba995f78dce66ebada4f1d7a3949b24 /Source
parent6db64ad43202af66270d996775e1504ba676b63d (diff)
downloadCMake-24c86e1c3ff5b507815e081f2173bc5b77358e78.zip
CMake-24c86e1c3ff5b507815e081f2173bc5b77358e78.tar.gz
CMake-24c86e1c3ff5b507815e081f2173bc5b77358e78.tar.bz2
cmake: Use array iteration for default generator VS variants
Diffstat (limited to 'Source')
-rw-r--r--Source/cmake.cxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 6ffa308..96a7b9a 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1448,10 +1448,10 @@ void cmake::CreateDefaultGlobalGenerator()
// Try to find the newest VS installed on the computer and
// use that as a default if -G is not specified
const std::string vsregBase = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\";
- std::vector<std::string> vsVerions;
- vsVerions.push_back("VisualStudio\\");
- vsVerions.push_back("VCExpress\\");
- vsVerions.push_back("WDExpress\\");
+ static const char* const vsVariants[] = {
+ /* clang-format needs this comment to break after the opening brace */
+ "VisualStudio\\", "VCExpress\\", "WDExpress\\"
+ };
struct VSVersionedGenerator
{
const char* MSVersion;
@@ -1470,8 +1470,9 @@ void cmake::CreateDefaultGlobalGenerator()
};
for (VSVersionedGenerator const* g = cmArrayBegin(vsGenerators);
g != cmArrayEnd(vsGenerators); ++g) {
- for (size_t b = 0; b < vsVerions.size(); b++) {
- std::string reg = vsregBase + vsVerions[b] + g->MSVersion;
+ for (const char* const* v = cmArrayBegin(vsVariants);
+ v != cmArrayEnd(vsVariants); ++v) {
+ std::string reg = vsregBase + *v + g->MSVersion;
reg += ";InstallDir";
std::string dir;
if (cmSystemTools::ReadRegistryValue(reg, dir,