cmCommand.cxx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmCommand.h"
  4. bool cmCommand::InvokeInitialPass(const std::vector<cmListFileArgument>& args,
  5. cmExecutionStatus& status)
  6. {
  7. std::vector<std::string> expandedArguments;
  8. if (!this->Makefile->ExpandArguments(args, expandedArguments)) {
  9. // There was an error expanding arguments. It was already
  10. // reported, so we can skip this command without error.
  11. return true;
  12. }
  13. return this->InitialPass(expandedArguments, status);
  14. }
  15. const char* cmCommand::GetError()
  16. {
  17. if (this->Error.empty()) {
  18. this->Error = this->GetName();
  19. this->Error += " unknown error.";
  20. }
  21. return this->Error.c_str();
  22. }
  23. void cmCommand::SetError(const std::string& e)
  24. {
  25. this->Error = this->GetName();
  26. this->Error += " ";
  27. this->Error += e;
  28. }
  29. bool cmCommand::Disallowed(cmPolicies::PolicyID pol, const char* e)
  30. {
  31. switch (this->Makefile->GetPolicyStatus(pol)) {
  32. case cmPolicies::WARN:
  33. this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,
  34. cmPolicies::GetPolicyWarning(pol));
  35. case cmPolicies::OLD:
  36. return false;
  37. case cmPolicies::REQUIRED_IF_USED:
  38. case cmPolicies::REQUIRED_ALWAYS:
  39. case cmPolicies::NEW:
  40. this->Makefile->IssueMessage(cmake::FATAL_ERROR, e);
  41. break;
  42. }
  43. return true;
  44. }