summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Goshi <jgoshi@microsoft.com>2019-09-03 17:25:44 (GMT)
committerBrad King <brad.king@kitware.com>2019-09-10 14:45:41 (GMT)
commit5355a60fd02417a004c6b4b6b8848ce0ff1ea9fa (patch)
tree2789f5870a70bcd1fafe72c3b8455caf75b91079
parenta20d2c85d02842a23ef1105daa078a821172cb4e (diff)
downloadCMake-5355a60fd02417a004c6b4b6b8848ce0ff1ea9fa.zip
CMake-5355a60fd02417a004c6b4b6b8848ce0ff1ea9fa.tar.gz
CMake-5355a60fd02417a004c6b4b6b8848ce0ff1ea9fa.tar.bz2
cmLocalGenerator: Add AppendCompileOptions overload with backtraces
-rw-r--r--Source/cmLocalGenerator.cxx24
-rw-r--r--Source/cmLocalGenerator.h3
2 files changed, 27 insertions, 0 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 144d995..bd5e5a2 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2422,6 +2422,30 @@ void cmLocalGenerator::AppendCompileOptions(
}
}
+void cmLocalGenerator::AppendCompileOptions(
+ std::vector<BT<std::string>>& options,
+ const std::vector<BT<std::string>>& options_vec, const char* regex) const
+{
+ if (regex != nullptr) {
+ // Filter flags upon specified regular expressions.
+ cmsys::RegularExpression r(regex);
+
+ for (BT<std::string> const& opt : options_vec) {
+ if (r.find(opt.Value)) {
+ std::string flag;
+ this->AppendFlagEscape(flag, opt.Value);
+ options.emplace_back(std::move(flag), opt.Backtrace);
+ }
+ }
+ } else {
+ for (BT<std::string> const& opt : options_vec) {
+ std::string flag;
+ this->AppendFlagEscape(flag, opt.Value);
+ options.emplace_back(std::move(flag), opt.Backtrace);
+ }
+ }
+}
+
void cmLocalGenerator::AppendIncludeDirectories(
std::vector<std::string>& includes, const char* includes_list,
const cmSourceFile& sourceFile) const
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 3c4e897..ec97ac2 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -199,6 +199,9 @@ public:
void AppendCompileOptions(std::string& options,
const std::vector<std::string>& options_vec,
const char* regex = nullptr) const;
+ void AppendCompileOptions(std::vector<BT<std::string>>& options,
+ const std::vector<BT<std::string>>& options_vec,
+ const char* regex = nullptr) const;
/**
* Join a set of defines into a definesString with a space separator.