summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx62
1 files changed, 29 insertions, 33 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 15439f6..5674317 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -343,19 +343,20 @@ void cmVisualStudio10TargetGenerator::Generate()
}
this->WriteString("<Platform>", 2);
- (*this->BuildFileStream) << this->Platform << "</Platform>\n";
+ (*this->BuildFileStream) << cmVS10EscapeXML(this->Platform)
+ << "</Platform>\n";
const char* projLabel = this->Target->GetProperty("PROJECT_LABEL");
if(!projLabel)
{
projLabel = this->Name.c_str();
}
this->WriteString("<ProjectName>", 2);
- (*this->BuildFileStream) << projLabel << "</ProjectName>\n";
+ (*this->BuildFileStream) << cmVS10EscapeXML(projLabel) << "</ProjectName>\n";
if(const char* targetFrameworkVersion = this->Target->GetProperty(
"VS_DOTNET_TARGET_FRAMEWORK_VERSION"))
{
this->WriteString("<TargetFrameworkVersion>", 2);
- (*this->BuildFileStream) << targetFrameworkVersion
+ (*this->BuildFileStream) << cmVS10EscapeXML(targetFrameworkVersion)
<< "</TargetFrameworkVersion>\n";
}
this->WriteString("</PropertyGroup>\n", 1);
@@ -507,7 +508,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
this->WriteString("<Configuration>", 3);
(*this->BuildFileStream ) << *i << "</Configuration>\n";
this->WriteString("<Platform>", 3);
- (*this->BuildFileStream) << this->Platform << "</Platform>\n";
+ (*this->BuildFileStream) << cmVS10EscapeXML(this->Platform)
+ << "</Platform>\n";
this->WriteString("</ProjectConfiguration>\n", 2);
}
this->WriteString("</ItemGroup>\n", 1);
@@ -700,7 +702,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile const* source,
(*this->BuildFileStream ) << script << "</Command>\n";
this->WritePlatformConfigTag("AdditionalInputs", i->c_str(), 3);
- (*this->BuildFileStream ) << source->GetFullPath();
+ (*this->BuildFileStream ) << cmVS10EscapeXML(source->GetFullPath());
for(std::vector<std::string>::const_iterator d =
ccg.GetDepends().begin();
d != ccg.GetDepends().end();
@@ -710,7 +712,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile const* source,
if(this->LocalGenerator->GetRealDependency(d->c_str(), i->c_str(), dep))
{
this->ConvertToWindowsSlash(dep);
- (*this->BuildFileStream ) << ";" << dep;
+ (*this->BuildFileStream ) << ";" << cmVS10EscapeXML(dep);
}
}
(*this->BuildFileStream ) << ";%(AdditionalInputs)</AdditionalInputs>\n";
@@ -723,7 +725,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile const* source,
{
std::string out = *o;
this->ConvertToWindowsSlash(out);
- (*this->BuildFileStream ) << sep << out;
+ (*this->BuildFileStream ) << sep << cmVS10EscapeXML(out);
sep = ";";
}
(*this->BuildFileStream ) << "</Outputs>\n";
@@ -824,7 +826,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
std::string obj = (*oi)->GetFullPath();
this->WriteString("<EmbeddedResource Include=\"", 2);
this->ConvertToWindowsSlash(obj);
- (*this->BuildFileStream ) << obj << "\">\n";
+ (*this->BuildFileStream ) << cmVS10EscapeXML(obj) << "\">\n";
this->WriteString("<Filter>Resource Files</Filter>\n", 3);
this->WriteString("</EmbeddedResource>\n", 2);
}
@@ -843,7 +845,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
std::string obj = *oi;
this->WriteString("<Object Include=\"", 2);
this->ConvertToWindowsSlash(obj);
- (*this->BuildFileStream ) << obj << "\">\n";
+ (*this->BuildFileStream ) << cmVS10EscapeXML(obj) << "\">\n";
this->WriteString("<Filter>Object Libraries</Filter>\n", 3);
this->WriteString("</Object>\n", 2);
}
@@ -978,7 +980,7 @@ WriteGroupSources(const char* name,
std::string path = this->ConvertPath(source, s->RelativePath);
this->ConvertToWindowsSlash(path);
(*this->BuildFileStream) << name << " Include=\""
- << path;
+ << cmVS10EscapeXML(path);
if(strlen(filter))
{
(*this->BuildFileStream) << "\">\n";
@@ -1033,7 +1035,8 @@ void cmVisualStudio10TargetGenerator::WriteSource(
}
this->ConvertToWindowsSlash(sourceFile);
this->WriteString("<", 2);
- (*this->BuildFileStream ) << tool << " Include=\"" << sourceFile << "\"";
+ (*this->BuildFileStream ) << tool << " Include=\""
+ << cmVS10EscapeXML(sourceFile) << "\"";
if(sf->GetExtension() == "h" &&
this->IsResxHeader(sf->GetFullPath()))
@@ -1165,7 +1168,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
std::string obj = *oi;
this->WriteString("<Object Include=\"", 2);
this->ConvertToWindowsSlash(obj);
- (*this->BuildFileStream ) << obj << "\" />\n";
+ (*this->BuildFileStream ) << cmVS10EscapeXML(obj) << "\" />\n";
}
this->WriteString("</ItemGroup>\n", 1);
@@ -1735,6 +1738,9 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
}
// Replace spaces in libs with ;
cmSystemTools::ReplaceString(libs, " ", ";");
+ std::vector<std::string> libVec;
+ cmSystemTools::ExpandListArgument(libs, libVec);
+
cmComputeLinkInformation* pcli =
this->Target->GetLinkInformation(config.c_str());
if(!pcli)
@@ -1746,28 +1752,21 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
}
// add the libraries for the target to libs string
cmComputeLinkInformation& cli = *pcli;
- this->AddLibraries(cli, libs);
- linkOptions.AddFlag("AdditionalDependencies", libs.c_str());
+ this->AddLibraries(cli, libVec);
+ linkOptions.AddFlag("AdditionalDependencies", libVec);
std::vector<std::string> const& ldirs = cli.GetDirectories();
- const char* sep = "";
- std::string linkDirs;
+ std::vector<std::string> linkDirs;
for(std::vector<std::string>::const_iterator d = ldirs.begin();
d != ldirs.end(); ++d)
{
// first just full path
- linkDirs += sep;
- linkDirs += *d;
- sep = ";";
- linkDirs += sep;
+ linkDirs.push_back(*d);
// next path with configuration type Debug, Release, etc
- linkDirs += *d;
- linkDirs += "/$(Configuration)";
- linkDirs += sep;
+ linkDirs.push_back(*d + "/$(Configuration)");
}
- linkDirs += "%(AdditionalLibraryDirectories)";
- linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs.c_str());
- linkOptions.AddFlag("AdditionalDependencies", libs.c_str());
+ linkDirs.push_back("%(AdditionalLibraryDirectories)");
+ linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs);
std::string targetName;
std::string targetNameSO;
@@ -1867,11 +1866,10 @@ cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& config)
void cmVisualStudio10TargetGenerator::AddLibraries(
cmComputeLinkInformation& cli,
- std::string& libstring)
+ std::vector<std::string>& libVec)
{
typedef cmComputeLinkInformation::ItemVector ItemVector;
ItemVector libs = cli.GetItems();
- const char* sep = ";";
for(ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l)
{
if(l->IsPath)
@@ -1881,14 +1879,12 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED);
this->ConvertToWindowsSlash(path);
- libstring += sep;
- libstring += path;
+ libVec.push_back(path);
}
else if (!l->Target
|| l->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
- libstring += sep;
- libstring += l->Value;
+ libVec.push_back(l->Value);
}
}
}
@@ -2051,7 +2047,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
path += dt->GetName();
path += ".vcxproj";
}
- (*this->BuildFileStream) << path << "\">\n";
+ (*this->BuildFileStream) << cmVS10EscapeXML(path) << "\">\n";
this->WriteString("<Project>", 3);
(*this->BuildFileStream)
<< this->GlobalGenerator->GetGUID(name.c_str())