cmSourceFilesRequireCommand.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 "cmSourceFilesRequireCommand.h"
  12. // cmSourceFilesRequireCommand
  13. bool cmSourceFilesRequireCommand::Invoke(std::vector<std::string>& args)
  14. {
  15. this->SetError(" deprecated - use SourceFiles command inside an If block ");
  16. return false;
  17. std::vector<std::string>::iterator i = args.begin();
  18. // Search to the key word SOURCES_BEGIN is found
  19. // if one of the required defines is not there, then
  20. // return as none of the source files will be added
  21. // if the required definition is not there.
  22. while(i != args.end() && (*i) != "SOURCES_BEGIN" )
  23. {
  24. if(!m_Makefile->GetDefinition((*i).c_str()))
  25. {
  26. return true;
  27. }
  28. i++;
  29. }
  30. if(i != args.end())
  31. {
  32. i++;
  33. }
  34. // Add the rest of the arguments as source files
  35. const char *sname = (*i).c_str();
  36. ++i;
  37. for(; i != args.end(); ++i)
  38. {
  39. cmSourceFile file;
  40. file.SetIsAnAbstractClass(false);
  41. file.SetName((*i).c_str(), m_Makefile->GetCurrentDirectory());
  42. m_Makefile->AddSource(file, sname);
  43. }
  44. return true;
  45. }