cmSourceFilesRequireCommand.cxx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 "cmSourceFilesRequireCommand.h"
  12. // cmSourceFilesRequireCommand
  13. bool cmSourceFilesRequireCommand::Invoke(std::vector<std::string>& args)
  14. {
  15. if(args.size() < 4 )
  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. const char *sname = (*i).c_str();
  39. ++i;
  40. for(; i != args.end(); ++i)
  41. {
  42. cmClassFile file;
  43. file.m_AbstractClass = false;
  44. file.SetName((*i).c_str(), m_Makefile->GetCurrentDirectory());
  45. m_Makefile->AddClass(file, sname);
  46. }
  47. return true;
  48. }