MCPcopy Create free account
hub / github.com/Kitware/CMake / HandleReplaceCommand

Function HandleReplaceCommand

Source/cmStringCommand.cxx:402–423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

400}
401
402bool HandleReplaceCommand(std::vector<std::string> const& args,
403 cmExecutionStatus& status)
404{
405 if (args.size() < 5) {
406 status.SetError("sub-command REPLACE requires at least four arguments.");
407 return false;
408 }
409
410 try {
411 std::string const& matchExpression = args[1];
412 std::string const& replaceExpression = args[2];
413 std::string const& variableName = args[3];
414 cm::CMakeString data{ cmMakeRange(args).advance(4) };
415
416 data.Replace(matchExpression, replaceExpression);
417 status.GetMakefile().AddDefinition(variableName, data);
418 return true;
419 } catch (std::exception const& e) {
420 status.SetError(cmStrCat("sub-command REPLACE: ", e.what(), '.'));
421 return false;
422 }
423}
424
425bool HandleSubstringCommand(std::vector<std::string> const& args,
426 cmExecutionStatus& status)

Callers

nothing calls this directly

Calls 9

cmMakeRangeFunction · 0.85
cmStrCatFunction · 0.70
sizeMethod · 0.45
SetErrorMethod · 0.45
advanceMethod · 0.45
ReplaceMethod · 0.45
AddDefinitionMethod · 0.45
GetMakefileMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…