From 5355a60fd02417a004c6b4b6b8848ce0ff1ea9fa Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Tue, 3 Sep 2019 10:25:44 -0700 Subject: cmLocalGenerator: Add AppendCompileOptions overload with backtraces --- Source/cmLocalGenerator.cxx | 24 ++++++++++++++++++++++++ Source/cmLocalGenerator.h | 3 +++ 2 files changed, 27 insertions(+) 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>& options, + const std::vector>& options_vec, const char* regex) const +{ + if (regex != nullptr) { + // Filter flags upon specified regular expressions. + cmsys::RegularExpression r(regex); + + for (BT 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 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& 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& options_vec, const char* regex = nullptr) const; + void AppendCompileOptions(std::vector>& options, + const std::vector>& options_vec, + const char* regex = nullptr) const; /** * Join a set of defines into a definesString with a space separator. -- cgit v0.12