summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorArtur Ryt <artur.ryt@gmail.com>2019-02-14 19:39:24 (GMT)
committerArtur Ryt <artur.ryt@gmail.com>2019-02-15 22:40:30 (GMT)
commit706b93fa558c5a2e0e45a7068b5039d1f40fbc90 (patch)
tree6f0e1695ac30f5e4d18eb12ac45094456ca401a4 /Source/cmGlobalGenerator.cxx
parent8c4de819449bbb1710b1cc2440357757e5cb757c (diff)
downloadCMake-706b93fa558c5a2e0e45a7068b5039d1f40fbc90.zip
CMake-706b93fa558c5a2e0e45a7068b5039d1f40fbc90.tar.gz
CMake-706b93fa558c5a2e0e45a7068b5039d1f40fbc90.tar.bz2
Modernize: C-arrays and loops over them
It replaces C arrays with deduced std::initializer_lists or std::array what makes enables for-loop over them.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx23
1 files changed, 11 insertions, 12 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 11c382f..fa0ffcc 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -7,6 +7,7 @@
#include <algorithm>
#include <assert.h>
#include <cstring>
+#include <initializer_list>
#include <iterator>
#include <sstream>
#include <stdio.h>
@@ -2280,10 +2281,9 @@ void cmGlobalGenerator::AddGlobalTarget_Package(
return;
}
- const char* reservedTargets[] = { "package", "PACKAGE" };
- for (const char* const* tn = cm::cbegin(reservedTargets);
- tn != cm::cend(reservedTargets); ++tn) {
- if (!this->CheckCMP0037(*tn, "when CPack packaging is enabled")) {
+ static const auto reservedTargets = { "package", "PACKAGE" };
+ for (auto const& target : reservedTargets) {
+ if (!this->CheckCMP0037(target, "when CPack packaging is enabled")) {
return;
}
}
@@ -2330,10 +2330,10 @@ void cmGlobalGenerator::AddGlobalTarget_PackageSource(
return;
}
- const char* reservedTargets[] = { "package_source" };
- for (const char* const* tn = cm::cbegin(reservedTargets);
- tn != cm::cend(reservedTargets); ++tn) {
- if (!this->CheckCMP0037(*tn, "when CPack source packaging is enabled")) {
+ static const auto reservedTargets = { "package_source" };
+ for (auto const& target : reservedTargets) {
+ if (!this->CheckCMP0037(target,
+ "when CPack source packaging is enabled")) {
return;
}
}
@@ -2360,10 +2360,9 @@ void cmGlobalGenerator::AddGlobalTarget_Test(
return;
}
- const char* reservedTargets[] = { "test", "RUN_TESTS" };
- for (const char* const* tn = cm::cbegin(reservedTargets);
- tn != cm::cend(reservedTargets); ++tn) {
- if (!this->CheckCMP0037(*tn, "when CTest testing is enabled")) {
+ static const auto reservedTargets = { "test", "RUN_TESTS" };
+ for (auto const& target : reservedTargets) {
+ if (!this->CheckCMP0037(target, "when CTest testing is enabled")) {
return;
}
}