| 509 | } |
| 510 | |
| 511 | bool 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 | |
| 535 | cmState::Command cmState::GetCommand(std::string const& name) const |
| 536 | { |
no test coverage detected