cmAlgorithms: Add cmWrap.

Port some existing cmJoin to use it.

cmJoin is cumbersome to use in cases where the objective is to
somehow 'quote' each item and then join it with a separator.  In that
case, the joiner string is harder to read and reason about.  cmWrap
aims to solve that.

Provide an overload taking char wrappers to simplify the case
of surrounding every element in quotes without needing to escape
the quote character.
This commit is contained in:
Stephen Kelly
2015-02-18 23:50:36 +01:00
parent a281809384
commit 37b88d348a
5 changed files with 22 additions and 19 deletions
+1 -6
View File
@@ -724,12 +724,7 @@ cmLocalUnixMakefileGenerator3
}
// Write the list of commands.
for(std::vector<std::string>::const_iterator i = commands.begin();
i != commands.end(); ++i)
{
replace = *i;
os << "\t" << replace << "\n";
}
os << cmWrap("\t", commands, "", "\n") << "\n";
if(symbolic && !this->WatcomWMake)
{
os << ".PHONY : " << cmMakeSafe(tgt) << "\n";