cmLoadCacheCommand.cxx 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 "cmLoadCacheCommand.h"
  12. // cmLoadcacheCommand
  13. bool cmLoadCacheCommand::InitialPass(std::vector<std::string> const& argsIn)
  14. {
  15. if (argsIn.size()< 1)
  16. {
  17. this->SetError("called with wrong number of arguments.");
  18. }
  19. std::vector<std::string> args = argsIn;
  20. // Cache entries to be excluded from the import list.
  21. // If this set is empty, all cache entries are brought in
  22. // and they can not be overridden.
  23. bool excludeFiles=false;
  24. unsigned int i;
  25. std::set<std::string> excludes;
  26. for(i=0; i<args.size(); i++)
  27. {
  28. if (excludeFiles)
  29. {
  30. m_Makefile->ExpandVariablesInString(args[i]);
  31. excludes.insert(args[i]);
  32. }
  33. if (args[i] == "EXCLUDE")
  34. {
  35. excludeFiles=true;
  36. }
  37. if (excludeFiles && (args[i] == "INCLUDE_INTERNALS"))
  38. {
  39. break;
  40. }
  41. }
  42. // Internal cache entries to be imported.
  43. // If this set is empty, no internal cache entries are
  44. // brought in.
  45. bool includeFiles=false;
  46. std::set<std::string> includes;
  47. for(i=0; i<args.size(); i++)
  48. {
  49. if (includeFiles)
  50. {
  51. m_Makefile->ExpandVariablesInString(args[i]);
  52. includes.insert(args[i]);
  53. }
  54. if (args[i] == "INCLUDE_INTERNALS")
  55. {
  56. includeFiles=true;
  57. }
  58. if (includeFiles && (args[i] == "EXCLUDE"))
  59. {
  60. break;
  61. }
  62. }
  63. for(i=0; i<args.size(); i++)
  64. {
  65. if ((args[i] == "EXCLUDE") || (args[i] == "INCLUDE_INTERNALS"))
  66. {
  67. break;
  68. }
  69. m_Makefile->ExpandVariablesInString(args[i]);
  70. cmCacheManager::GetInstance()->LoadCache(args[i].c_str(), false,
  71. excludes, includes);
  72. cmCacheManager::GetInstance()->DefineCache(m_Makefile);
  73. }
  74. return true;
  75. }