You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.1 KiB

  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 "cmSetDirectoryPropertiesCommand.h"
  14. #include "cmake.h"
  15. // cmSetDirectoryPropertiesCommand
  16. bool cmSetDirectoryPropertiesCommand::InitialPass(
  17. std::vector<std::string> const& args)
  18. {
  19. if(args.size() < 1 )
  20. {
  21. this->SetError("called with incorrect number of arguments");
  22. return false;
  23. }
  24. std::string errors;
  25. bool ret =
  26. cmSetDirectoryPropertiesCommand::RunCommand(this->Makefile,
  27. args.begin() + 1,
  28. args.end(), errors);
  29. if (!ret)
  30. {
  31. this->SetError(errors.c_str());
  32. }
  33. return ret;
  34. }
  35. bool cmSetDirectoryPropertiesCommand
  36. ::RunCommand(cmMakefile *mf,
  37. std::vector<std::string>::const_iterator ait,
  38. std::vector<std::string>::const_iterator aitend,
  39. std::string &errors)
  40. {
  41. for (; ait != aitend; ait += 2 )
  42. {
  43. if ( ait +1 == aitend)
  44. {
  45. errors = "Wrong number of arguments";
  46. return false;
  47. }
  48. const std::string& prop = *ait;
  49. const std::string& value = *(ait+1);
  50. if ( prop == "VARIABLES" )
  51. {
  52. errors =
  53. "Variables and cache variables should be set using SET command";
  54. return false;
  55. }
  56. else if ( prop == "MACROS" )
  57. {
  58. errors =
  59. "Commands and macros cannot be set using SET_CMAKE_PROPERTIES";
  60. return false;
  61. }
  62. mf->SetProperty(prop.c_str(), value.c_str());
  63. }
  64. return true;
  65. }