summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-02-03 19:32:17 (GMT)
committerBrad King <brad.king@kitware.com>2012-02-03 19:35:35 (GMT)
commita03447b3dfb448b402a0451e4e436a135fee366e (patch)
tree1602fdb68e808083de385619bf3de1cc5076692f /Source/cmVisualStudio10TargetGenerator.cxx
parent9e01aefd24cd23878bd88c2f3cae62b5e28802b0 (diff)
downloadCMake-a03447b3dfb448b402a0451e4e436a135fee366e.zip
CMake-a03447b3dfb448b402a0451e4e436a135fee366e.tar.gz
CMake-a03447b3dfb448b402a0451e4e436a135fee366e.tar.bz2
VS: Simplify ;-separated attribute value parsing
An implementation ;-separated list parsing was added by commit a1f976ce (VS: Add support for three new project properties, 2011-11-23) and again by commit 9e01aefd (VS: Add support for WinRT project properties, 2012-02-03). Refactor both instances to use ExpandListArgument.
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx54
1 files changed, 20 insertions, 34 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 9193223..9418761 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -269,63 +269,49 @@ void cmVisualStudio10TargetGenerator::Generate()
void cmVisualStudio10TargetGenerator::WriteDotNetReferences()
{
- const char* vsDotNetReferences
- = this->Target->GetProperty("VS_DOTNET_REFERENCES");
- if(vsDotNetReferences)
+ std::vector<std::string> references;
+ if(const char* vsDotNetReferences =
+ this->Target->GetProperty("VS_DOTNET_REFERENCES"))
+ {
+ cmSystemTools::ExpandListArgument(vsDotNetReferences, references);
+ }
+ if(!references.empty())
{
- std::string references(vsDotNetReferences);
- std::string::size_type position = 0;
-
this->WriteString("<ItemGroup>\n", 1);
- while(references.length() > 0)
+ for(std::vector<std::string>::iterator ri = references.begin();
+ ri != references.end(); ++ri)
{
- if((position = references.find(";")) == std::string::npos)
- {
- position = references.length() + 1;
- }
-
this->WriteString("<Reference Include=\"", 2);
- (*this->BuildFileStream) <<
- cmVS10EscapeXML(references.substr(0, position)) << "\">\n";
+ (*this->BuildFileStream) << cmVS10EscapeXML(*ri) << "\">\n";
this->WriteString("<CopyLocalSatelliteAssemblies>true"
"</CopyLocalSatelliteAssemblies>\n", 3);
this->WriteString("<ReferenceOutputAssembly>true"
"</ReferenceOutputAssembly>\n", 3);
this->WriteString("</Reference>\n", 2);
-
- references.erase(0, position + 1);
}
-
this->WriteString("</ItemGroup>\n", 1);
}
}
void cmVisualStudio10TargetGenerator::WriteWinRTReferences()
{
- const char* vsWinRTReferences
- = this->Target->GetProperty("VS_WINRT_REFERENCES");
- if(vsWinRTReferences)
+ std::vector<std::string> references;
+ if(const char* vsWinRTReferences =
+ this->Target->GetProperty("VS_WINRT_REFERENCES"))
+ {
+ cmSystemTools::ExpandListArgument(vsWinRTReferences, references);
+ }
+ if(!references.empty())
{
- std::string references(vsWinRTReferences);
- std::string::size_type position = 0;
-
this->WriteString("<ItemGroup>\n", 1);
- while(references.length() > 0)
+ for(std::vector<std::string>::iterator ri = references.begin();
+ ri != references.end(); ++ri)
{
- if((position = references.find(";")) == std::string::npos)
- {
- position = references.length() + 1;
- }
-
this->WriteString("<Reference Include=\"", 2);
- (*this->BuildFileStream) <<
- cmVS10EscapeXML(references.substr(0, position)) << "\">\n";
+ (*this->BuildFileStream) << cmVS10EscapeXML(*ri) << "\">\n";
this->WriteString("<IsWinMDFile>true</IsWinMDFile>\n", 3);
this->WriteString("</Reference>\n", 2);
-
- references.erase(0, position + 1);
}
-
this->WriteString("</ItemGroup>\n", 1);
}
}