cmSetDirectoryPropertiesCommand.cxx 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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
  39. ("Variables and cache variables should be set using SET command");
  40. return false;
  41. }
  42. else if ( prop == "MACROS" )
  43. {
  44. this->SetError
  45. ("Commands and macros cannot be set using SET_CMAKE_PROPERTIES");
  46. return false;
  47. }
  48. else if ( prop == "INCLUDE_DIRECTORIES" )
  49. {
  50. std::vector<std::string> varArgsExpanded;
  51. cmSystemTools::ExpandListArgument(value, varArgsExpanded);
  52. this->Makefile->SetIncludeDirectories(varArgsExpanded);
  53. }
  54. else if ( prop == "LINK_DIRECTORIES" )
  55. {
  56. std::vector<std::string> varArgsExpanded;
  57. cmSystemTools::ExpandListArgument(value, varArgsExpanded);
  58. this->Makefile->SetLinkDirectories(varArgsExpanded);
  59. }
  60. else if ( prop == "INCLUDE_REGULAR_EXPRESSION" )
  61. {
  62. this->Makefile->SetIncludeRegularExpression(value.c_str());
  63. }
  64. else
  65. {
  66. if ( prop == "ADDITIONAL_MAKE_CLEAN_FILES" )
  67. {
  68. // This property is not inherrited
  69. if ( strcmp(this->Makefile->GetCurrentDirectory(),
  70. this->Makefile->GetStartDirectory()) != 0 )
  71. {
  72. continue;
  73. }
  74. }
  75. this->Makefile->SetProperty(prop.c_str(), value.c_str());
  76. }
  77. }
  78. return true;
  79. }