summaryrefslogtreecommitdiff
path: root/Source/cmIDEOptions.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmIDEOptions.cxx')
-rw-r--r--Source/cmIDEOptions.cxx57
1 files changed, 50 insertions, 7 deletions
diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx
index 5e872d2ff..354b757c8 100644
--- a/Source/cmIDEOptions.cxx
+++ b/Source/cmIDEOptions.cxx
@@ -13,6 +13,7 @@ cmIDEOptions::cmIDEOptions()
{
this->DoingDefine = false;
this->AllowDefine = true;
+ this->DoingInclude = false;
this->AllowSlash = false;
this->DoingFollowing = 0;
for (int i = 0; i < FlagTableCount; ++i) {
@@ -33,6 +34,13 @@ void cmIDEOptions::HandleFlag(const char* flag)
return;
}
+ // If the last option was -I then this option is the include directory.
+ if (this->DoingInclude) {
+ this->DoingInclude = false;
+ this->Includes.push_back(flag);
+ return;
+ }
+
// If the last option expected a following value, this is it.
if (this->DoingFollowing) {
this->FlagMapUpdate(this->DoingFollowing, flag);
@@ -53,6 +61,17 @@ void cmIDEOptions::HandleFlag(const char* flag)
}
return;
}
+ // Look for include directory.
+ if (this->AllowInclude && flag[1] == 'I') {
+ if (flag[2] == '\0') {
+ // The next argument will have the include directory.
+ this->DoingInclude = true;
+ } else {
+ // Store this include directory.
+ this->Includes.push_back(flag + 2);
+ }
+ return;
+ }
// Look through the available flag tables.
bool flag_handled = false;
@@ -155,12 +174,35 @@ std::vector<std::string> const& cmIDEOptions::GetDefines() const
return this->Defines;
}
-void cmIDEOptions::AddFlag(const char* flag, const char* value)
+void cmIDEOptions::AddInclude(const std::string& include)
+{
+ this->Includes.push_back(include);
+}
+
+void cmIDEOptions::AddIncludes(const char* includes)
+{
+ if (includes) {
+ // Expand the list of includes.
+ cmSystemTools::ExpandListArgument(includes, this->Includes);
+ }
+}
+void cmIDEOptions::AddIncludes(const std::vector<std::string>& includes)
+{
+ this->Includes.insert(this->Includes.end(), includes.begin(),
+ includes.end());
+}
+
+std::vector<std::string> const& cmIDEOptions::GetIncludes() const
+{
+ return this->Includes;
+}
+
+void cmIDEOptions::AddFlag(std::string const& flag, std::string const& value)
{
this->FlagMap[flag] = value;
}
-void cmIDEOptions::AddFlag(const char* flag,
+void cmIDEOptions::AddFlag(std::string const& flag,
std::vector<std::string> const& value)
{
this->FlagMap[flag] = value;
@@ -185,7 +227,7 @@ void cmIDEOptions::AppendFlagString(std::string const& flag,
this->FlagMap[flag].append_with_space(value);
}
-void cmIDEOptions::RemoveFlag(const char* flag)
+void cmIDEOptions::RemoveFlag(std::string const& flag)
{
this->FlagMap.erase(flag);
}
@@ -195,12 +237,13 @@ bool cmIDEOptions::HasFlag(std::string const& flag) const
return this->FlagMap.find(flag) != this->FlagMap.end();
}
-const char* cmIDEOptions::GetFlag(const char* flag)
+const char* cmIDEOptions::GetFlag(std::string const& flag) const
{
// 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) {
+ std::map<std::string, FlagValue>::const_iterator i =
+ this->FlagMap.find(flag);
+ if (i != this->FlagMap.cend() && i->second.size() == 1) {
return i->second[0].c_str();
}
- return 0;
+ return nullptr;
}