cmSourceFilesRequireRule.cxx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2000 National Library of Medicine
  8. All rights reserved.
  9. See COPYRIGHT.txt for copyright details.
  10. =========================================================================*/
  11. #include "cmSourceFilesRequireRule.h"
  12. // cmSourceFilesRequireRule
  13. bool cmSourceFilesRequireRule::Invoke(std::vector<std::string>& args)
  14. {
  15. if(args.size() < 3 )
  16. {
  17. this->SetError("called with incorrect number of arguments");
  18. return false;
  19. }
  20. std::vector<std::string>::iterator i = args.begin();
  21. // Search to the key word SOURCES_BEGIN is found
  22. // if one of the required defines is not there, then
  23. // return as none of the source files will be added
  24. // if the required definition is not there.
  25. while(i != args.end() && (*i) != "SOURCES_BEGIN" )
  26. {
  27. if(!m_Makefile->GetDefinition((*i).c_str()))
  28. {
  29. return true;
  30. }
  31. i++;
  32. }
  33. if(i != args.end())
  34. {
  35. i++;
  36. }
  37. // Add the rest of the arguments as source files
  38. for(; i != args.end(); ++i)
  39. {
  40. cmClassFile file;
  41. file.m_AbstractClass = false;
  42. file.SetName((*i).c_str(), m_Makefile->GetCurrentDirectory());
  43. m_Makefile->AddClass(file);
  44. }
  45. return true;
  46. }