cmSetDirectoryPropertiesCommand.cxx 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include "cmSetDirectoryPropertiesCommand.h"
  11. #include "cmake.h"
  12. // cmSetDirectoryPropertiesCommand
  13. bool cmSetDirectoryPropertiesCommand
  14. ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
  15. {
  16. if(args.size() < 1 )
  17. {
  18. this->SetError("called with incorrect number of arguments");
  19. return false;
  20. }
  21. std::string errors;
  22. bool ret =
  23. cmSetDirectoryPropertiesCommand::RunCommand(this->Makefile,
  24. args.begin() + 1,
  25. args.end(), errors);
  26. if (!ret)
  27. {
  28. this->SetError(errors.c_str());
  29. }
  30. return ret;
  31. }
  32. bool cmSetDirectoryPropertiesCommand
  33. ::RunCommand(cmMakefile *mf,
  34. std::vector<std::string>::const_iterator ait,
  35. std::vector<std::string>::const_iterator aitend,
  36. std::string &errors)
  37. {
  38. for (; ait != aitend; ait += 2 )
  39. {
  40. if ( ait +1 == aitend)
  41. {
  42. errors = "Wrong number of arguments";
  43. return false;
  44. }
  45. const std::string& prop = *ait;
  46. const std::string& value = *(ait+1);
  47. if ( prop == "VARIABLES" )
  48. {
  49. errors =
  50. "Variables and cache variables should be set using SET command";
  51. return false;
  52. }
  53. else if ( prop == "MACROS" )
  54. {
  55. errors =
  56. "Commands and macros cannot be set using SET_CMAKE_PROPERTIES";
  57. return false;
  58. }
  59. mf->SetProperty(prop.c_str(), value.c_str());
  60. }
  61. return true;
  62. }