Do Windows command line escapes for VS 10 too
Until now the VS 10 generator did no Windows command-line escaping and just did XML escapes. This commit teaches the generator to use the same command-line escape addition code used by other generators. The script construction method cmLocalVisualStudioGenerator::ConstructScript need not do XML escapes. Each VS generator version adds the XML escapes necessary for that version.
This commit is contained in:
parent
f143dc2af2
commit
355511ade9
|
@ -68,7 +68,6 @@ class cmVS10XMLParser : public cmXMLParser
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmLocalVisualStudio10Generator::cmLocalVisualStudio10Generator()
|
cmLocalVisualStudio10Generator::cmLocalVisualStudio10Generator()
|
||||||
{
|
{
|
||||||
this->NeedXMLEscape = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmLocalVisualStudio10Generator::~cmLocalVisualStudio10Generator()
|
cmLocalVisualStudio10Generator::~cmLocalVisualStudio10Generator()
|
||||||
|
|
|
@ -26,7 +26,6 @@ cmLocalVisualStudioGenerator::cmLocalVisualStudioGenerator()
|
||||||
{
|
{
|
||||||
this->WindowsShell = true;
|
this->WindowsShell = true;
|
||||||
this->WindowsVSIDE = true;
|
this->WindowsVSIDE = true;
|
||||||
this->NeedXMLEscape = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -230,23 +229,6 @@ cmLocalVisualStudioGenerator
|
||||||
{
|
{
|
||||||
script += this->EscapeForShellOldStyle(commandLine[j].c_str());
|
script += this->EscapeForShellOldStyle(commandLine[j].c_str());
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if(this->NeedXMLEscape)
|
|
||||||
{
|
|
||||||
std::string arg = commandLine[j];
|
|
||||||
cmSystemTools::ReplaceString(arg, "&", "&");
|
|
||||||
cmSystemTools::ReplaceString(arg, "<", "<");
|
|
||||||
cmSystemTools::ReplaceString(arg, ">", ">");
|
|
||||||
if(arg.find(" ") != arg.npos)
|
|
||||||
{
|
|
||||||
std::string q("\"");
|
|
||||||
arg = q + arg +q;
|
|
||||||
}
|
|
||||||
script += arg;
|
|
||||||
//script += this->EscapeForShell(arg.c_str(),
|
|
||||||
//escapeAllowMakeVars);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
script += this->EscapeForShell(commandLine[j].c_str(),
|
script += this->EscapeForShell(commandLine[j].c_str(),
|
||||||
|
@ -254,7 +236,6 @@ cmLocalVisualStudioGenerator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return script;
|
return script;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,6 @@ protected:
|
||||||
std::map<cmStdString, int>& count);
|
std::map<cmStdString, int>& count);
|
||||||
void InsertNeedObjectNames(const std::vector<cmSourceGroup>& groups,
|
void InsertNeedObjectNames(const std::vector<cmSourceGroup>& groups,
|
||||||
std::map<cmStdString, int>& count);
|
std::map<cmStdString, int>& count);
|
||||||
bool NeedXMLEscape;
|
|
||||||
std::set<const cmSourceFile*> NeedObjectName;
|
std::set<const cmSourceFile*> NeedObjectName;
|
||||||
friend class cmVisualStudio10TargetGenerator;
|
friend class cmVisualStudio10TargetGenerator;
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,6 +27,13 @@
|
||||||
#include "cmVS10LinkFlagTable.h"
|
#include "cmVS10LinkFlagTable.h"
|
||||||
#include "cmVS10LibFlagTable.h"
|
#include "cmVS10LibFlagTable.h"
|
||||||
|
|
||||||
|
static std::string cmVS10EscapeXML(std::string arg)
|
||||||
|
{
|
||||||
|
cmSystemTools::ReplaceString(arg, "&", "&");
|
||||||
|
cmSystemTools::ReplaceString(arg, "<", "<");
|
||||||
|
cmSystemTools::ReplaceString(arg, ">", ">");
|
||||||
|
return arg;
|
||||||
|
}
|
||||||
|
|
||||||
cmVisualStudio10TargetGenerator::
|
cmVisualStudio10TargetGenerator::
|
||||||
cmVisualStudio10TargetGenerator(cmTarget* target,
|
cmVisualStudio10TargetGenerator(cmTarget* target,
|
||||||
|
@ -290,11 +297,13 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
|
||||||
i != configs->end(); ++i)
|
i != configs->end(); ++i)
|
||||||
{
|
{
|
||||||
std::string script =
|
std::string script =
|
||||||
|
cmVS10EscapeXML(
|
||||||
lg->ConstructScript(command.GetCommandLines(),
|
lg->ConstructScript(command.GetCommandLines(),
|
||||||
command.GetWorkingDirectory(),
|
command.GetWorkingDirectory(),
|
||||||
i->c_str(),
|
i->c_str(),
|
||||||
command.GetEscapeOldStyle(),
|
command.GetEscapeOldStyle(),
|
||||||
command.GetEscapeAllowMakeVars());
|
command.GetEscapeAllowMakeVars())
|
||||||
|
);
|
||||||
this->WritePlatformConfigTag("Message",i->c_str(), 3);
|
this->WritePlatformConfigTag("Message",i->c_str(), 3);
|
||||||
(*this->BuildFileStream ) << comment << "</Message>\n";
|
(*this->BuildFileStream ) << comment << "</Message>\n";
|
||||||
this->WritePlatformConfigTag("Command", i->c_str(), 3);
|
this->WritePlatformConfigTag("Command", i->c_str(), 3);
|
||||||
|
@ -1203,11 +1212,13 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
|
||||||
script += pre;
|
script += pre;
|
||||||
pre = "\n";
|
pre = "\n";
|
||||||
script +=
|
script +=
|
||||||
|
cmVS10EscapeXML(
|
||||||
lg->ConstructScript(command.GetCommandLines(),
|
lg->ConstructScript(command.GetCommandLines(),
|
||||||
command.GetWorkingDirectory(),
|
command.GetWorkingDirectory(),
|
||||||
configName.c_str(),
|
configName.c_str(),
|
||||||
command.GetEscapeOldStyle(),
|
command.GetEscapeOldStyle(),
|
||||||
command.GetEscapeAllowMakeVars());
|
command.GetEscapeAllowMakeVars())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
this->WriteString("<Message>",3);
|
this->WriteString("<Message>",3);
|
||||||
(*this->BuildFileStream ) << comment << "</Message>\n";
|
(*this->BuildFileStream ) << comment << "</Message>\n";
|
||||||
|
|
Loading…
Reference in New Issue