| 264 | } |
| 265 | |
| 266 | bool RegexReplace(std::vector<std::string> const& args, |
| 267 | cmExecutionStatus& status) |
| 268 | { |
| 269 | //"STRING(REGEX REPLACE <regular_expression> <replace_expression> |
| 270 | // <output variable> <input> [<input>...])\n" |
| 271 | std::string const& regex = args[2]; |
| 272 | std::string const& replace = args[3]; |
| 273 | std::string const& outvar = args[4]; |
| 274 | |
| 275 | try { |
| 276 | cm::CMakeString data{ cmMakeRange(args).advance(5) }; |
| 277 | |
| 278 | data.Replace(regex, replace, cm::CMakeString::Regex::Yes, |
| 279 | &status.GetMakefile()); |
| 280 | // Store the result in the provided variable. |
| 281 | status.GetMakefile().AddDefinition(outvar, data); |
| 282 | return true; |
| 283 | } catch (std::exception const& e) { |
| 284 | status.SetError( |
| 285 | cmStrCat("sub-command REGEX, mode REPLACE: ", e.what(), '.')); |
| 286 | return false; |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | bool RegexQuote(std::vector<std::string> const& args, |
| 291 | cmExecutionStatus& status) |
no test coverage detected
searching dependent graphs…