| 442 | } |
| 443 | |
| 444 | void cmState::AddDisallowedCommand(std::string const& name, |
| 445 | BuiltinCommand command, |
| 446 | cmPolicies::PolicyID policy, |
| 447 | char const* message, |
| 448 | char const* additionalWarning) |
| 449 | { |
| 450 | this->AddBuiltinCommand( |
| 451 | name, |
| 452 | [command, policy, message, |
| 453 | additionalWarning](std::vector<cmListFileArgument> const& args, |
| 454 | cmExecutionStatus& status) -> bool { |
| 455 | cmMakefile& mf = status.GetMakefile(); |
| 456 | switch (mf.GetPolicyStatus(policy)) { |
| 457 | case cmPolicies::WARN: { |
| 458 | std::string warning = cmPolicies::GetPolicyWarning(policy); |
| 459 | if (additionalWarning) { |
| 460 | warning = cmStrCat(warning, '\n', additionalWarning); |
| 461 | } |
| 462 | mf.IssueMessage(MessageType::AUTHOR_WARNING, warning); |
| 463 | } |
| 464 | CM_FALLTHROUGH; |
| 465 | case cmPolicies::OLD: |
| 466 | break; |
| 467 | case cmPolicies::NEW: |
| 468 | mf.IssueMessage(MessageType::FATAL_ERROR, message); |
| 469 | return true; |
| 470 | } |
| 471 | return InvokeBuiltinCommand(command, args, status); |
| 472 | }); |
| 473 | } |
| 474 | |
| 475 | void cmState::AddRemovedCommand(std::string const& name, |
| 476 | std::string const& message) |
no test coverage detected