cmCMakePolicyCommand.cxx 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmCMakePolicyCommand.h"
  14. #include "cmVersion.h"
  15. // cmCMakePolicyCommand
  16. bool cmCMakePolicyCommand
  17. ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
  18. {
  19. if (args.size() < 1)
  20. {
  21. this->SetError("cmake_policy requires at least one argument.");
  22. return false;
  23. }
  24. if (args[0] == "OLD" && args.size() == 2)
  25. {
  26. return this->Makefile->SetPolicy(args[1].c_str(),cmPolicies::OLD);
  27. }
  28. if (args[0] == "NEW" && args.size() == 2)
  29. {
  30. return this->Makefile->SetPolicy(args[1].c_str(),cmPolicies::NEW);
  31. }
  32. if (args[0] == "VERSION" && args.size() == 2)
  33. {
  34. return this->Makefile->SetPolicyVersion(args[1].c_str());
  35. }
  36. if (args[0] == "PUSH" && args.size() == 1)
  37. {
  38. return this->Makefile->PushPolicy();
  39. }
  40. if (args[0] == "POP" && args.size() == 1)
  41. {
  42. return this->Makefile->PopPolicy();
  43. }
  44. this->SetError("incorrect arguments for cmake_policy.");
  45. return false;
  46. }