cmLoadCacheCommand.cxx 2.0 KB

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