summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.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/cmTarget.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/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index e871634..d1e4f06 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -5,6 +5,7 @@
#include "cmsys/RegularExpression.hxx"
#include <algorithm>
#include <assert.h>
+#include <initializer_list>
#include <iterator>
#include <set>
#include <sstream>
@@ -312,23 +313,23 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
// Setup per-configuration property default values.
if (this->GetType() != cmStateEnums::UTILITY) {
- const char* configProps[] = {
+ static const auto configProps = {
/* clang-format needs this comment to break after the opening brace */
"ARCHIVE_OUTPUT_DIRECTORY_", "LIBRARY_OUTPUT_DIRECTORY_",
"RUNTIME_OUTPUT_DIRECTORY_", "PDB_OUTPUT_DIRECTORY_",
"COMPILE_PDB_OUTPUT_DIRECTORY_", "MAP_IMPORTED_CONFIG_",
- "INTERPROCEDURAL_OPTIMIZATION_", nullptr
+ "INTERPROCEDURAL_OPTIMIZATION_"
};
for (std::string const& configName : configNames) {
std::string configUpper = cmSystemTools::UpperCase(configName);
- for (const char** p = configProps; *p; ++p) {
+ for (auto const& prop : configProps) {
// Interface libraries have no output locations, so honor only
// the configuration map.
if (this->TargetTypeValue == cmStateEnums::INTERFACE_LIBRARY &&
- strcmp(*p, "MAP_IMPORTED_CONFIG_") != 0) {
+ strcmp(prop, "MAP_IMPORTED_CONFIG_") != 0) {
continue;
}
- std::string property = *p;
+ std::string property = prop;
property += configUpper;
this->SetPropertyDefault(property, nullptr);
}