1
0

cmSourceGroupCommand.cxx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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 "cmSourceGroupCommand.h"
  14. // cmSourceGroupCommand
  15. bool cmSourceGroupCommand::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. if ( args[1] == "REGULAR_EXPRESSION" && args.size() == 3 )
  23. {
  24. m_Makefile->AddSourceGroup(args[0].c_str(), args[2].c_str());
  25. return true;
  26. }
  27. if ( args[1] == "FILES" )
  28. {
  29. cmSourceGroup* sg = m_Makefile->GetSourceGroup(args[0].c_str());
  30. if ( !sg )
  31. {
  32. m_Makefile->AddSourceGroup(args[0].c_str(), 0);
  33. sg = m_Makefile->GetSourceGroup(args[0].c_str());
  34. }
  35. unsigned int cc;
  36. for ( cc = 3; cc < args.size(); cc ++ )
  37. {
  38. sg->AddSource(args[cc].c_str(), 0);
  39. }
  40. return true;
  41. }
  42. if ( args.size() == 2 )
  43. {
  44. m_Makefile->AddSourceGroup(args[0].c_str(), args[1].c_str());
  45. return true;
  46. }
  47. this->SetError("called with incorrect number of arguments");
  48. return false;
  49. }