summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-02-15 14:35:36 (GMT)
committerBrad King <brad.king@kitware.com>2017-02-15 15:36:09 (GMT)
commit3936a2886efc1fd46560352f3a48d6a656f95367 (patch)
tree25a3471d6115013682d7496c7ffd79972f0ea5cf
parent72cfb3c3d2e8f6167cf08289691f7b0c61d0d331 (diff)
downloadCMake-3936a2886efc1fd46560352f3a48d6a656f95367.zip
CMake-3936a2886efc1fd46560352f3a48d6a656f95367.tar.gz
CMake-3936a2886efc1fd46560352f3a48d6a656f95367.tar.bz2
cmIDEOptions: Add SpaceAppendable flag table type
-rw-r--r--Source/cmIDEFlagTable.h3
-rw-r--r--Source/cmIDEOptions.cxx8
-rw-r--r--Source/cmIDEOptions.h11
3 files changed, 22 insertions, 0 deletions
diff --git a/Source/cmIDEFlagTable.h b/Source/cmIDEFlagTable.h
index 64ade76..152e293 100644
--- a/Source/cmIDEFlagTable.h
+++ b/Source/cmIDEFlagTable.h
@@ -24,6 +24,9 @@ struct cmIDEFlagTable
// IgnoreDefaultLibraryNames)
UserFollowing = (1 << 5), // expect value in following argument
CaseInsensitive = (1 << 6), // flag may be any case
+ SpaceAppendable = (1 << 7), // a flag that if specified multiple times
+ // should have its value appended to the
+ // old value with spaces
UserValueIgnored = UserValue | UserIgnored,
UserValueRequired = UserValue | UserRequired
diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx
index c6c0e05..1c0a99e 100644
--- a/Source/cmIDEOptions.cxx
+++ b/Source/cmIDEOptions.cxx
@@ -125,6 +125,8 @@ void cmIDEOptions::FlagMapUpdate(cmIDEFlagTable const* entry,
this->FlagMap[entry->IDEName] = entry->value;
} else if (entry->special & cmIDEFlagTable::SemicolonAppendable) {
this->FlagMap[entry->IDEName].push_back(new_value);
+ } else if (entry->special & cmIDEFlagTable::SpaceAppendable) {
+ this->FlagMap[entry->IDEName].append_with_space(new_value);
} else {
// Use the user-specified value.
this->FlagMap[entry->IDEName] = new_value;
@@ -172,6 +174,12 @@ void cmIDEOptions::AppendFlag(std::string const& flag,
std::copy(value.begin(), value.end(), std::back_inserter(fv));
}
+void cmIDEOptions::AppendFlagString(std::string const& flag,
+ std::string const& value)
+{
+ this->FlagMap[flag].append_with_space(value);
+}
+
void cmIDEOptions::RemoveFlag(const char* flag)
{
this->FlagMap.erase(flag);
diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h
index a0696e1..aaa9d3d 100644
--- a/Source/cmIDEOptions.h
+++ b/Source/cmIDEOptions.h
@@ -29,6 +29,7 @@ public:
void AppendFlag(std::string const& flag, std::string const& value);
void AppendFlag(std::string const& flag,
std::vector<std::string> const& value);
+ void AppendFlagString(std::string const& flag, std::string const& value);
void RemoveFlag(const char* flag);
bool HasFlag(std::string const& flag) const;
const char* GetFlag(const char* flag);
@@ -57,6 +58,16 @@ protected:
this->derived::operator=(r);
return *this;
}
+ FlagValue& append_with_space(std::string const& r)
+ {
+ this->resize(1);
+ std::string& l = this->operator[](0);
+ if (!l.empty()) {
+ l += " ";
+ }
+ l += r;
+ return *this;
+ }
};
std::map<std::string, FlagValue> FlagMap;