summaryrefslogtreecommitdiffstats
path: root/Source/cmcmd.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-02-18 22:50:36 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-02-20 20:35:58 (GMT)
commit37b88d348a20921c835ce7aa99f6db62271503a7 (patch)
tree96259ea4c15995957740dfbf421ebed066cb221f /Source/cmcmd.cxx
parenta281809384cc19cc9a7d1726b243020b380b9395 (diff)
downloadCMake-37b88d348a20921c835ce7aa99f6db62271503a7.zip
CMake-37b88d348a20921c835ce7aa99f6db62271503a7.tar.gz
CMake-37b88d348a20921c835ce7aa99f6db62271503a7.tar.bz2
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.
Diffstat (limited to 'Source/cmcmd.cxx')
-rw-r--r--Source/cmcmd.cxx4
1 files changed, 1 insertions, 3 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index eb637ef..7d67bd8 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -450,9 +450,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
return 1;
}
- std::string command = "\"";
- command += cmJoin(cmRange(args).advance(3), "\" \"");
- command += "\"";
+ std::string command = cmWrap('"', cmRange(args).advance(3), '"', " ");
int retval = 0;
int timeout = 0;
if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, &retval,