summaryrefslogtreecommitdiffstats
path: root/Source/cmCMakePresetsFile.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmCMakePresetsFile.cxx')
-rw-r--r--Source/cmCMakePresetsFile.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/Source/cmCMakePresetsFile.cxx b/Source/cmCMakePresetsFile.cxx
index fbe9fe5..d44dfb3 100644
--- a/Source/cmCMakePresetsFile.cxx
+++ b/Source/cmCMakePresetsFile.cxx
@@ -11,6 +11,8 @@
#include <cm/string_view>
+#include "cmsys/RegularExpression.hxx"
+
#include "cmCMakePresetsFileInternal.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -561,6 +563,24 @@ bool cmCMakePresetsFileInternal::InListCondition::Evaluate(
return true;
}
+bool cmCMakePresetsFileInternal::MatchesCondition::Evaluate(
+ const std::vector<MacroExpander>& expanders, int version,
+ cm::optional<bool>& out) const
+{
+ std::string str = this->String;
+ CHECK_EXPAND(out, str, expanders, version);
+ std::string regexStr = this->Regex;
+ CHECK_EXPAND(out, regexStr, expanders, version);
+
+ cmsys::RegularExpression regex;
+ if (!regex.compile(regexStr)) {
+ return false;
+ }
+
+ out = regex.find(str);
+ return true;
+}
+
bool cmCMakePresetsFileInternal::AnyAllOfCondition::Evaluate(
const std::vector<MacroExpander>& expanders, int version,
cm::optional<bool>& out) const