summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-09-07 14:11:20 (GMT)
committerBrad King <brad.king@kitware.com>2009-09-07 14:11:20 (GMT)
commit355511ade9fd1be71835359a9b085586446e50c2 (patch)
tree9f414f4b3c4e45a93ae9e2eb9b859638b4d3d282 /Source
parentf143dc2af2c65dcac3434fd531794a79e313ec01 (diff)
downloadCMake-355511ade9fd1be71835359a9b085586446e50c2.zip
CMake-355511ade9fd1be71835359a9b085586446e50c2.tar.gz
CMake-355511ade9fd1be71835359a9b085586446e50c2.tar.bz2
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.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx1
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx21
-rw-r--r--Source/cmLocalVisualStudioGenerator.h1
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx35
4 files changed, 24 insertions, 34 deletions
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 44318f4..80f98f2 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -68,7 +68,6 @@ class cmVS10XMLParser : public cmXMLParser
//----------------------------------------------------------------------------
cmLocalVisualStudio10Generator::cmLocalVisualStudio10Generator()
{
- this->NeedXMLEscape = true;
}
cmLocalVisualStudio10Generator::~cmLocalVisualStudio10Generator()
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index da214cf..4706a96 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -26,7 +26,6 @@ cmLocalVisualStudioGenerator::cmLocalVisualStudioGenerator()
{
this->WindowsShell = true;
this->WindowsVSIDE = true;
- this->NeedXMLEscape = false;
}
//----------------------------------------------------------------------------
@@ -232,26 +231,8 @@ cmLocalVisualStudioGenerator
}
else
{
- if(this->NeedXMLEscape)
- {
- std::string arg = commandLine[j];
- cmSystemTools::ReplaceString(arg, "&", "&amp;");
- cmSystemTools::ReplaceString(arg, "<", "&lt;");
- cmSystemTools::ReplaceString(arg, ">", "&gt;");
- if(arg.find(" ") != arg.npos)
- {
- std::string q("\"");
- arg = q + arg +q;
- }
- script += arg;
- //script += this->EscapeForShell(arg.c_str(),
- //escapeAllowMakeVars);
- }
- else
- {
- script += this->EscapeForShell(commandLine[j].c_str(),
+ script += this->EscapeForShell(commandLine[j].c_str(),
escapeAllowMakeVars);
- }
}
}
}
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index 4b31599..a6bdfbf 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -56,7 +56,6 @@ protected:
std::map<cmStdString, int>& count);
void InsertNeedObjectNames(const std::vector<cmSourceGroup>& groups,
std::map<cmStdString, int>& count);
- bool NeedXMLEscape;
std::set<const cmSourceFile*> NeedObjectName;
friend class cmVisualStudio10TargetGenerator;
};
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 2a96932..e8aaf61 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -27,6 +27,13 @@
#include "cmVS10LinkFlagTable.h"
#include "cmVS10LibFlagTable.h"
+static std::string cmVS10EscapeXML(std::string arg)
+{
+ cmSystemTools::ReplaceString(arg, "&", "&amp;");
+ cmSystemTools::ReplaceString(arg, "<", "&lt;");
+ cmSystemTools::ReplaceString(arg, ">", "&gt;");
+ return arg;
+}
cmVisualStudio10TargetGenerator::
cmVisualStudio10TargetGenerator(cmTarget* target,
@@ -289,12 +296,14 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
for(std::vector<std::string>::iterator i = configs->begin();
i != configs->end(); ++i)
{
- std::string script =
- lg->ConstructScript(command.GetCommandLines(),
- command.GetWorkingDirectory(),
- i->c_str(),
- command.GetEscapeOldStyle(),
- command.GetEscapeAllowMakeVars());
+ std::string script =
+ cmVS10EscapeXML(
+ lg->ConstructScript(command.GetCommandLines(),
+ command.GetWorkingDirectory(),
+ i->c_str(),
+ command.GetEscapeOldStyle(),
+ command.GetEscapeAllowMakeVars())
+ );
this->WritePlatformConfigTag("Message",i->c_str(), 3);
(*this->BuildFileStream ) << comment << "</Message>\n";
this->WritePlatformConfigTag("Command", i->c_str(), 3);
@@ -1202,12 +1211,14 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
comment += lg->ConstructComment(command);
script += pre;
pre = "\n";
- script +=
- lg->ConstructScript(command.GetCommandLines(),
- command.GetWorkingDirectory(),
- configName.c_str(),
- command.GetEscapeOldStyle(),
- command.GetEscapeAllowMakeVars());
+ script +=
+ cmVS10EscapeXML(
+ lg->ConstructScript(command.GetCommandLines(),
+ command.GetWorkingDirectory(),
+ configName.c_str(),
+ command.GetEscapeOldStyle(),
+ command.GetEscapeAllowMakeVars())
+ );
}
this->WriteString("<Message>",3);
(*this->BuildFileStream ) << comment << "</Message>\n";