cmSubdirCommand.cxx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. for(std::vector<std::string>::const_iterator i = args.begin();
  24. i != args.end(); ++i)
  25. {
  26. std::string directory = std::string(m_Makefile->GetCurrentDirectory()) +
  27. "/" + i->c_str();
  28. if ( cmSystemTools::FileIsDirectory(directory.c_str()) )
  29. {
  30. m_Makefile->AddSubDirectory(i->c_str());
  31. }
  32. else
  33. {
  34. std::string error = "Incorrect SUBDIRS command. Directory: ";
  35. error += directory + " does not exists.";
  36. this->SetError(error.c_str());
  37. res = false;
  38. }
  39. }
  40. return res;
  41. }