summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-04-18 16:02:00 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2002-04-18 16:02:00 (GMT)
commit72022ac27ba0ec4476a468b789c600f00edab669 (patch)
tree64ad77f30fa8b6ec3c73d5b9557a37ffb2b74ce6
parent71fb2a2386a8efface0f68ff912c1522b103b2fa (diff)
downloadCMake-72022ac27ba0ec4476a468b789c600f00edab669.zip
CMake-72022ac27ba0ec4476a468b789c600f00edab669.tar.gz
CMake-72022ac27ba0ec4476a468b789c600f00edab669.tar.bz2
ENH: add ability to escape semi-colons
-rw-r--r--Source/cmMessageCommand.cxx7
-rw-r--r--Source/cmSystemTools.cxx27
-rw-r--r--Tests/Complex/CMakeLists.txt1
-rw-r--r--Tests/ComplexOneConfig/CMakeLists.txt1
-rw-r--r--Tests/ComplexRelativePaths/CMakeLists.txt1
5 files changed, 31 insertions, 6 deletions
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index 0cb2661..809cfe6 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -18,14 +18,15 @@
#include "cmCacheManager.h"
// cmLibraryCommand
-bool cmMessageCommand::InitialPass(std::vector<std::string> const& args)
+bool cmMessageCommand::InitialPass(std::vector<std::string> const& argsIn)
{
- if(args.size() < 1 )
+ if(argsIn.size() < 1 )
{
this->SetError("called with incorrect number of arguments");
return false;
}
-
+ std::vector<std::string> args;
+ cmSystemTools::ExpandListArguments(argsIn, args);
std::string message;
std::vector<std::string>::const_iterator i = args.begin();
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 5b96fc0..27b53d3 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -853,7 +853,7 @@ std::string cmSystemTools::RemoveEscapes(const char* s)
std::string result = "";
for(const char* ch = s; *ch; ++ch)
{
- if(*ch == '\\')
+ if(*ch == '\\' && *(ch+1) != ';')
{
++ch;
switch (*ch)
@@ -1788,6 +1788,7 @@ void cmSystemTools::ExpandListArguments(std::vector<std::string> const& argument
std::vector<std::string>& newargs)
{
std::vector<std::string>::const_iterator i;
+ std::string newarg;
for(i = arguments.begin();i != arguments.end(); ++i)
{
// if there are no ; in the name then just copy the current string
@@ -1808,6 +1809,20 @@ void cmSystemTools::ExpandListArguments(std::vector<std::string> const& argument
{
endpos = i->size();
}
+ else
+ {
+ // skip right over escaped ; ( \; )
+ while((endpos != std::string::npos)
+ && (endpos > 0)
+ && ((*i)[endpos-1] == '\\') )
+ {
+ endpos = i->find(';', endpos+1);
+ }
+ if(endpos == std::string::npos)
+ {
+ endpos = i->size();
+ }
+ }
std::string::size_type len = endpos - start;
if (len > 0)
{
@@ -1815,7 +1830,7 @@ void cmSystemTools::ExpandListArguments(std::vector<std::string> const& argument
if(i->find('[', start) == std::string::npos)
{
// if there is no [ in the string then keep it
- newargs.push_back(i->substr(start, len));
+ newarg = i->substr(start, len);
}
else
{
@@ -1842,8 +1857,14 @@ void cmSystemTools::ExpandListArguments(std::vector<std::string> const& argument
}
len = endpos - start;
}
- newargs.push_back(i->substr(start, len));
+ newarg = i->substr(start, len);
+ }
+ std::string::size_type pos = newarg.find("\\;");
+ if(pos != std::string::npos)
+ {
+ newarg[pos] = ' ';
}
+ newargs.push_back(newarg);
}
start = endpos+1;
}
diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt
index c2448a4..d80d654 100644
--- a/Tests/Complex/CMakeLists.txt
+++ b/Tests/Complex/CMakeLists.txt
@@ -58,6 +58,7 @@ SET (EXECUTABLE_OUTPUT_PATH
${Complex_BINARY_DIR}/bin/ CACHE PATH
"Single output directory for building all executables.")
+MESSAGE (Test " " escape " " semi-colon " " \; \;)
#
# Exec program (TODO: test a result)
# Increase coverage.
diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt
index c2448a4..d80d654 100644
--- a/Tests/ComplexOneConfig/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/CMakeLists.txt
@@ -58,6 +58,7 @@ SET (EXECUTABLE_OUTPUT_PATH
${Complex_BINARY_DIR}/bin/ CACHE PATH
"Single output directory for building all executables.")
+MESSAGE (Test " " escape " " semi-colon " " \; \;)
#
# Exec program (TODO: test a result)
# Increase coverage.
diff --git a/Tests/ComplexRelativePaths/CMakeLists.txt b/Tests/ComplexRelativePaths/CMakeLists.txt
index c2448a4..d80d654 100644
--- a/Tests/ComplexRelativePaths/CMakeLists.txt
+++ b/Tests/ComplexRelativePaths/CMakeLists.txt
@@ -58,6 +58,7 @@ SET (EXECUTABLE_OUTPUT_PATH
${Complex_BINARY_DIR}/bin/ CACHE PATH
"Single output directory for building all executables.")
+MESSAGE (Test " " escape " " semi-colon " " \; \;)
#
# Exec program (TODO: test a result)
# Increase coverage.