summaryrefslogtreecommitdiffstats
path: root/Source/cmIDEOptions.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/cmIDEOptions.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/cmIDEOptions.cxx')
-rw-r--r--Source/cmIDEOptions.cxx27
1 files changed, 12 insertions, 15 deletions
diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx
index 1f3c066..dfbece7 100644
--- a/Source/cmIDEOptions.cxx
+++ b/Source/cmIDEOptions.cxx
@@ -152,18 +152,7 @@ void cmIDEOptions::FlagMapUpdate(cmIDEFlagTable const* entry,
}
else if(entry->special & cmIDEFlagTable::SemicolonAppendable)
{
- std::map<std::string,std::string>::iterator itr;
- itr = this->FlagMap.find(entry->IDEName);
- if(itr != this->FlagMap.end())
- {
- // Append to old value (if present) with semicolons;
- itr->second += ";";
- itr->second += new_value;
- }
- else
- {
- this->FlagMap[entry->IDEName] = new_value;
- }
+ this->FlagMap[entry->IDEName].push_back(new_value);
}
else
{
@@ -200,6 +189,13 @@ void cmIDEOptions::AddFlag(const char* flag, const char* value)
}
//----------------------------------------------------------------------------
+void cmIDEOptions::AddFlag(const char* flag,
+ std::vector<std::string> const& value)
+{
+ this->FlagMap[flag] = value;
+}
+
+//----------------------------------------------------------------------------
void cmIDEOptions::RemoveFlag(const char* flag)
{
this->FlagMap.erase(flag);
@@ -208,10 +204,11 @@ void cmIDEOptions::RemoveFlag(const char* flag)
//----------------------------------------------------------------------------
const char* cmIDEOptions::GetFlag(const char* flag)
{
- std::map<std::string, std::string>::iterator i = this->FlagMap.find(flag);
- if(i != this->FlagMap.end())
+ // This method works only for single-valued flags!
+ std::map<std::string, FlagValue>::iterator i = this->FlagMap.find(flag);
+ if(i != this->FlagMap.end() && i->second.size() == 1)
{
- return i->second.c_str();
+ return i->second[0].c_str();
}
return 0;
}