cmLoadCacheCommand.cxx 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmLoadCacheCommand.h"
  14. // cmLoadcacheCommand
  15. bool cmLoadCacheCommand::InitialPass(std::vector<std::string> const& argsIn)
  16. {
  17. if (argsIn.size()< 1)
  18. {
  19. this->SetError("called with wrong number of arguments.");
  20. }
  21. std::vector<std::string> args = argsIn;
  22. // Cache entries to be excluded from the import list.
  23. // If this set is empty, all cache entries are brought in
  24. // and they can not be overridden.
  25. bool excludeFiles=false;
  26. unsigned int i;
  27. std::set<std::string> excludes;
  28. for(i=0; i<args.size(); i++)
  29. {
  30. if (excludeFiles)
  31. {
  32. m_Makefile->ExpandVariablesInString(args[i]);
  33. excludes.insert(args[i]);
  34. }
  35. if (args[i] == "EXCLUDE")
  36. {
  37. excludeFiles=true;
  38. }
  39. if (excludeFiles && (args[i] == "INCLUDE_INTERNALS"))
  40. {
  41. break;
  42. }
  43. }
  44. // Internal cache entries to be imported.
  45. // If this set is empty, no internal cache entries are
  46. // brought in.
  47. bool includeFiles=false;
  48. std::set<std::string> includes;
  49. for(i=0; i<args.size(); i++)
  50. {
  51. if (includeFiles)
  52. {
  53. m_Makefile->ExpandVariablesInString(args[i]);
  54. includes.insert(args[i]);
  55. }
  56. if (args[i] == "INCLUDE_INTERNALS")
  57. {
  58. includeFiles=true;
  59. }
  60. if (includeFiles && (args[i] == "EXCLUDE"))
  61. {
  62. break;
  63. }
  64. }
  65. // Loop over each build directory listed in the arguments. Each
  66. // directory has a cache file.
  67. for(i=0; i<args.size(); i++)
  68. {
  69. if ((args[i] == "EXCLUDE") || (args[i] == "INCLUDE_INTERNALS"))
  70. {
  71. break;
  72. }
  73. m_Makefile->ExpandVariablesInString(args[i]);
  74. cmCacheManager::GetInstance()->LoadCache(args[i].c_str(), false,
  75. excludes, includes);
  76. }
  77. return true;
  78. }