diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index d88de1ed3..b9bd67b57 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -302,4 +302,12 @@ typename Range::const_iterator cmFindNot(Range const& r, T const& t) std::bind1st(std::not_equal_to(), t)); } +template +ContainerAlgorithms::Range +cmReverseRange(Range const& range) +{ + return ContainerAlgorithms::Range( + range.rbegin(), range.rend()); +} + #endif diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 0c6adfd11..17617aae8 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -390,8 +390,7 @@ bool cmListCommand return false; } - std::reverse(varArgsExpanded.begin(), varArgsExpanded.end()); - std::string value = cmJoin(varArgsExpanded, ";"); + std::string value = cmJoin(cmReverseRange(varArgsExpanded), ";"); this->Makefile->AddDefinition(listName, value.c_str()); return true;