ENH: add ability to escape semi-colons
This commit is contained in:
parent
71fb2a2386
commit
72022ac27b
@ -18,14 +18,15 @@
|
|||||||
#include "cmCacheManager.h"
|
#include "cmCacheManager.h"
|
||||||
|
|
||||||
// cmLibraryCommand
|
// 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");
|
this->SetError("called with incorrect number of arguments");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
std::vector<std::string> args;
|
||||||
|
cmSystemTools::ExpandListArguments(argsIn, args);
|
||||||
std::string message;
|
std::string message;
|
||||||
std::vector<std::string>::const_iterator i = args.begin();
|
std::vector<std::string>::const_iterator i = args.begin();
|
||||||
|
|
||||||
|
@ -853,7 +853,7 @@ std::string cmSystemTools::RemoveEscapes(const char* s)
|
|||||||
std::string result = "";
|
std::string result = "";
|
||||||
for(const char* ch = s; *ch; ++ch)
|
for(const char* ch = s; *ch; ++ch)
|
||||||
{
|
{
|
||||||
if(*ch == '\\')
|
if(*ch == '\\' && *(ch+1) != ';')
|
||||||
{
|
{
|
||||||
++ch;
|
++ch;
|
||||||
switch (*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>& newargs)
|
||||||
{
|
{
|
||||||
std::vector<std::string>::const_iterator i;
|
std::vector<std::string>::const_iterator i;
|
||||||
|
std::string newarg;
|
||||||
for(i = arguments.begin();i != arguments.end(); ++i)
|
for(i = arguments.begin();i != arguments.end(); ++i)
|
||||||
{
|
{
|
||||||
// if there are no ; in the name then just copy the current string
|
// 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();
|
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;
|
std::string::size_type len = endpos - start;
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
@ -1815,7 +1830,7 @@ void cmSystemTools::ExpandListArguments(std::vector<std::string> const& argument
|
|||||||
if(i->find('[', start) == std::string::npos)
|
if(i->find('[', start) == std::string::npos)
|
||||||
{
|
{
|
||||||
// if there is no [ in the string then keep it
|
// if there is no [ in the string then keep it
|
||||||
newargs.push_back(i->substr(start, len));
|
newarg = i->substr(start, len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1842,8 +1857,14 @@ void cmSystemTools::ExpandListArguments(std::vector<std::string> const& argument
|
|||||||
}
|
}
|
||||||
len = endpos - start;
|
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;
|
start = endpos+1;
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,7 @@ SET (EXECUTABLE_OUTPUT_PATH
|
|||||||
${Complex_BINARY_DIR}/bin/ CACHE PATH
|
${Complex_BINARY_DIR}/bin/ CACHE PATH
|
||||||
"Single output directory for building all executables.")
|
"Single output directory for building all executables.")
|
||||||
|
|
||||||
|
MESSAGE (Test " " escape " " semi-colon " " \; \;)
|
||||||
#
|
#
|
||||||
# Exec program (TODO: test a result)
|
# Exec program (TODO: test a result)
|
||||||
# Increase coverage.
|
# Increase coverage.
|
||||||
|
@ -58,6 +58,7 @@ SET (EXECUTABLE_OUTPUT_PATH
|
|||||||
${Complex_BINARY_DIR}/bin/ CACHE PATH
|
${Complex_BINARY_DIR}/bin/ CACHE PATH
|
||||||
"Single output directory for building all executables.")
|
"Single output directory for building all executables.")
|
||||||
|
|
||||||
|
MESSAGE (Test " " escape " " semi-colon " " \; \;)
|
||||||
#
|
#
|
||||||
# Exec program (TODO: test a result)
|
# Exec program (TODO: test a result)
|
||||||
# Increase coverage.
|
# Increase coverage.
|
||||||
|
@ -58,6 +58,7 @@ SET (EXECUTABLE_OUTPUT_PATH
|
|||||||
${Complex_BINARY_DIR}/bin/ CACHE PATH
|
${Complex_BINARY_DIR}/bin/ CACHE PATH
|
||||||
"Single output directory for building all executables.")
|
"Single output directory for building all executables.")
|
||||||
|
|
||||||
|
MESSAGE (Test " " escape " " semi-colon " " \; \;)
|
||||||
#
|
#
|
||||||
# Exec program (TODO: test a result)
|
# Exec program (TODO: test a result)
|
||||||
# Increase coverage.
|
# Increase coverage.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user