cmSetDirectoryPropertiesCommand.cxx 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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::vector<std::string>::const_iterator ait;
  25. for ( ait = args.begin()+1;
  26. ait != args.end();
  27. ait += 2 )
  28. {
  29. if ( ait +1 == args.end() )
  30. {
  31. this->SetError("Wrong number of arguments");
  32. return false;
  33. }
  34. const std::string& prop = *ait;
  35. const std::string& value = *(ait+1);
  36. if ( prop == "VARIABLES" )
  37. {
  38. this->SetError("Variables and cache variables should be set using SET command");
  39. return false;
  40. }
  41. else if ( prop == "MACROS" )
  42. {
  43. this->SetError("Commands and macros cannot be set using SET_CMAKE_PROPERTIES");
  44. return false;
  45. }
  46. else if ( prop == "INCLUDE_DIRECTORIES" )
  47. {
  48. std::vector<std::string> varArgsExpanded;
  49. cmSystemTools::ExpandListArgument(value, varArgsExpanded);
  50. this->Makefile->SetIncludeDirectories(varArgsExpanded);
  51. }
  52. else if ( prop == "LINK_DIRECTORIES" )
  53. {
  54. std::vector<std::string> varArgsExpanded;
  55. cmSystemTools::ExpandListArgument(value, varArgsExpanded);
  56. this->Makefile->SetLinkDirectories(varArgsExpanded);
  57. }
  58. else if ( prop == "INCLUDE_REGULAR_EXPRESSION" )
  59. {
  60. this->Makefile->SetIncludeRegularExpression(value.c_str());
  61. }
  62. else
  63. {
  64. if ( prop == "ADDITIONAL_MAKE_CLEAN_FILES" )
  65. {
  66. // This property is not inherrited
  67. if ( strcmp(this->Makefile->GetCurrentDirectory(), this->Makefile->GetStartDirectory()) != 0 )
  68. {
  69. continue;
  70. }
  71. }
  72. this->Makefile->SetProperty(prop.c_str(), value.c_str());
  73. }
  74. }
  75. return true;
  76. }