summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-07-23 15:13:13 (GMT)
committerBrad King <brad.king@kitware.com>2014-07-23 18:18:53 (GMT)
commit1c209ac165cd2c25c632cdd238a9948c1651f907 (patch)
tree5996e7a96458af31fd09cba0232c2dbd15de54e8 /Source/cmVisualStudio10TargetGenerator.cxx
parent91c933546d1eebb6a637f403824d63177c86c11e (diff)
downloadCMake-1c209ac165cd2c25c632cdd238a9948c1651f907.zip
CMake-1c209ac165cd2c25c632cdd238a9948c1651f907.tar.gz
CMake-1c209ac165cd2c25c632cdd238a9948c1651f907.tar.bz2
cmIDEOption: Store mapped flag values as a vector<string>
Some FlagMap entries are ;-lists. Store values as vector<string> so that individual values may contain ';' characters. Delay the construction of the final ;-list until writing to the VS project file. With this approach the generated file may contain ;-separated values that contain encoded ';' characters.
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx32
1 files changed, 13 insertions, 19 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 35c48cf..2429e59 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1735,6 +1735,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,27 +1749,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());
+ linkDirs.push_back("%(AdditionalLibraryDirectories)");
+ linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs);
std::string targetName;
std::string targetNameSO;
@@ -1866,11 +1863,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)
@@ -1880,14 +1876,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);
}
}
}