cmSubdirCommand.cxx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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& argsIn)
  16. {
  17. if(argsIn.size() < 1 )
  18. {
  19. this->SetError("called with incorrect number of arguments");
  20. return false;
  21. }
  22. std::vector<std::string> args;
  23. cmSystemTools::ExpandListArguments(argsIn, args);
  24. bool res = true;
  25. for(std::vector<std::string>::const_iterator i = args.begin();
  26. i != args.end(); ++i)
  27. {
  28. std::string directory = std::string(m_Makefile->GetCurrentDirectory()) +
  29. "/" + i->c_str();
  30. if ( cmSystemTools::FileIsDirectory(directory.c_str()) )
  31. {
  32. m_Makefile->AddSubDirectory(i->c_str());
  33. }
  34. else
  35. {
  36. std::string error = "Incorrect SUBDIRS command. Directory: ";
  37. error += directory + " does not exists.";
  38. this->SetError(error.c_str());
  39. res = false;
  40. }
  41. }
  42. return res;
  43. }