cmSubdirCommand.cxx 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 "cmSubdirCommand.h"
  14. // cmSubdirCommand
  15. bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args)
  16. {
  17. if(args.size() < 1 )
  18. {
  19. this->SetError("called with incorrect number of arguments");
  20. return false;
  21. }
  22. bool res = true;
  23. bool intoplevel = true;
  24. bool preorder = false;
  25. for(std::vector<std::string>::const_iterator i = args.begin();
  26. i != args.end(); ++i)
  27. {
  28. if(*i == "EXCLUDE_FROM_ALL")
  29. {
  30. intoplevel = false;
  31. continue;
  32. }
  33. if(*i == "PREORDER")
  34. {
  35. preorder = true;
  36. continue;
  37. }
  38. std::string directory = std::string(m_Makefile->GetCurrentDirectory()) +
  39. "/" + i->c_str();
  40. if ( cmSystemTools::FileIsDirectory(directory.c_str()) )
  41. {
  42. m_Makefile->AddSubDirectory(i->c_str(), intoplevel, preorder);
  43. }
  44. else
  45. {
  46. std::string error = "Incorrect SUBDIRS command. Directory: ";
  47. error += directory + " does not exists.";
  48. this->SetError(error.c_str());
  49. res = false;
  50. }
  51. }
  52. return res;
  53. }