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

Method AddScriptedCommand

Source/cmState.cxx:511–533  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

509}
510
511bool cmState::AddScriptedCommand(std::string const& name, BT<Command> command,
512 cmMakefile& mf)
513{
514 std::string sName = cmSystemTools::LowerCase(name);
515
516 if (this->FlowControlCommands.count(sName)) {
517 mf.GetCMakeInstance()->IssueMessage(
518 MessageType::FATAL_ERROR,
519 cmStrCat("Built-in flow control command \"", sName,
520 "\" cannot be overridden."),
521 command.Backtrace);
522 cmSystemTools::SetFatalErrorOccurred();
523 return false;
524 }
525
526 // if the command already exists, give a new name to the old command.
527 if (Command oldCmd = this->GetCommandByExactName(sName)) {
528 this->ScriptedCommands["_" + sName] = oldCmd;
529 }
530
531 this->ScriptedCommands[sName] = std::move(command.Value);
532 return true;
533}
534
535cmState::Command cmState::GetCommand(std::string const& name) const
536{

Callers 2

ReplayMethod · 0.80
ReplayMethod · 0.80

Calls 6

GetCommandByExactNameMethod · 0.95
moveFunction · 0.85
cmStrCatFunction · 0.70
countMethod · 0.45
IssueMessageMethod · 0.45
GetCMakeInstanceMethod · 0.45

Tested by

no test coverage detected