summaryrefslogtreecommitdiffstats
path: root/Source/cmCustomCommandGenerator.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-05-04 22:04:22 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-05-14 18:30:09 (GMT)
commita3139d4b1512195485cde49d919a13cdaec62660 (patch)
treec735f45a9c0e602090b29543cf8caeaa86255542 /Source/cmCustomCommandGenerator.cxx
parent443f041c2fa0355b9b622337da0612ce48cf29b6 (diff)
downloadCMake-a3139d4b1512195485cde49d919a13cdaec62660.zip
CMake-a3139d4b1512195485cde49d919a13cdaec62660.tar.gz
CMake-a3139d4b1512195485cde49d919a13cdaec62660.tar.bz2
cmLocalGenerator: Remove EscapeForShellOldStyle to only caller.
Diffstat (limited to 'Source/cmCustomCommandGenerator.cxx')
-rw-r--r--Source/cmCustomCommandGenerator.cxx31
1 files changed, 30 insertions, 1 deletions
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 162d7a1..d23f815 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -51,6 +51,35 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
}
//----------------------------------------------------------------------------
+std::string escapeForShellOldStyle(const std::string& str)
+{
+ std::string result;
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ // if there are spaces
+ std::string temp = str;
+ if (temp.find(" ") != std::string::npos &&
+ temp.find("\"")==std::string::npos)
+ {
+ result = "\"";
+ result += str;
+ result += "\"";
+ return result;
+ }
+ return str;
+#else
+ for(const char* ch = str.c_str(); *ch != '\0'; ++ch)
+ {
+ if(*ch == ' ')
+ {
+ result += '\\';
+ }
+ result += *ch;
+ }
+ return result;
+#endif
+}
+
+//----------------------------------------------------------------------------
void
cmCustomCommandGenerator
::AppendArguments(unsigned int c, std::string& cmd) const
@@ -63,7 +92,7 @@ cmCustomCommandGenerator
cmd += " ";
if(this->OldStyle)
{
- cmd += this->LG->EscapeForShellOldStyle(arg);
+ cmd += escapeForShellOldStyle(arg);
}
else
{