diff options
Diffstat (limited to 'Source/cmSetPropertyCommand.cxx')
-rw-r--r-- | Source/cmSetPropertyCommand.cxx | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 3c4111b..2a0ccb4 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -4,6 +4,7 @@ #include <sstream> +#include "cmAlgorithms.h" #include "cmGlobalGenerator.h" #include "cmInstalledFile.h" #include "cmMakefile.h" @@ -33,25 +34,25 @@ bool cmSetPropertyCommand::InitialPass(std::vector<std::string> const& args, } // Get the scope on which to set the property. - std::vector<std::string>::const_iterator arg = args.begin(); + std::string const& scopeName = args.front(); cmProperty::ScopeType scope; - if (*arg == "GLOBAL") { + if (scopeName == "GLOBAL") { scope = cmProperty::GLOBAL; - } else if (*arg == "DIRECTORY") { + } else if (scopeName == "DIRECTORY") { scope = cmProperty::DIRECTORY; - } else if (*arg == "TARGET") { + } else if (scopeName == "TARGET") { scope = cmProperty::TARGET; - } else if (*arg == "SOURCE") { + } else if (scopeName == "SOURCE") { scope = cmProperty::SOURCE_FILE; - } else if (*arg == "TEST") { + } else if (scopeName == "TEST") { scope = cmProperty::TEST; - } else if (*arg == "CACHE") { + } else if (scopeName == "CACHE") { scope = cmProperty::CACHE; - } else if (*arg == "INSTALL") { + } else if (scopeName == "INSTALL") { scope = cmProperty::INSTALL; } else { std::ostringstream e; - e << "given invalid scope " << *arg << ". " + e << "given invalid scope " << scopeName << ". " << "Valid scopes are GLOBAL, DIRECTORY, " "TARGET, SOURCE, TEST, CACHE, INSTALL."; this->SetError(e.str()); @@ -68,32 +69,32 @@ bool cmSetPropertyCommand::InitialPass(std::vector<std::string> const& args, }; Doing doing = DoingNames; const char* sep = ""; - for (++arg; arg != args.end(); ++arg) { - if (*arg == "PROPERTY") { + for (std::string const& arg : cmMakeRange(args).advance(1)) { + if (arg == "PROPERTY") { doing = DoingProperty; - } else if (*arg == "APPEND") { + } else if (arg == "APPEND") { doing = DoingNone; this->AppendMode = true; this->Remove = false; this->AppendAsString = false; - } else if (*arg == "APPEND_STRING") { + } else if (arg == "APPEND_STRING") { doing = DoingNone; this->AppendMode = true; this->Remove = false; this->AppendAsString = true; } else if (doing == DoingNames) { - this->Names.insert(*arg); + this->Names.insert(arg); } else if (doing == DoingProperty) { - this->PropertyName = *arg; + this->PropertyName = arg; doing = DoingValues; } else if (doing == DoingValues) { this->PropertyValue += sep; sep = ";"; - this->PropertyValue += *arg; + this->PropertyValue += arg; this->Remove = false; } else { std::ostringstream e; - e << "given invalid argument \"" << *arg << "\"."; + e << "given invalid argument \"" << arg << "\"."; this->SetError(e.str()); return false; } |