| 220 | } |
| 221 | |
| 222 | bool RegexMatch(std::vector<std::string> const& args, |
| 223 | cmExecutionStatus& status) |
| 224 | { |
| 225 | //"STRING(REGEX MATCH <regular_expression> <output variable> |
| 226 | // <input> [<input>...])\n"; |
| 227 | try { |
| 228 | std::string const& regex = args[2]; |
| 229 | std::string const& outvar = args[3]; |
| 230 | cm::CMakeString data{ cmMakeRange(args).advance(4) }; |
| 231 | |
| 232 | auto result = data.Match(regex, cm::CMakeString::MatchItems::Once, |
| 233 | &status.GetMakefile()); |
| 234 | // Store the result in the provided variable. |
| 235 | status.GetMakefile().AddDefinition(outvar, result.to_string()); |
| 236 | return true; |
| 237 | } catch (std::exception const& e) { |
| 238 | status.SetError( |
| 239 | cmStrCat("sub-command REGEX, mode MATCH: ", e.what(), '.')); |
| 240 | return false; |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | bool RegexMatchAll(std::vector<std::string> const& args, |
| 245 | cmExecutionStatus& status) |
no test coverage detected
searching dependent graphs…