cmLoadCacheCommand.cxx 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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& args)
  16. {
  17. if (args.size()< 1)
  18. {
  19. this->SetError("called with wrong number of arguments.");
  20. }
  21. // Cache entries to be excluded from the import list.
  22. // If this set is empty, all cache entries are brought in
  23. // and they can not be overridden.
  24. bool excludeFiles=false;
  25. unsigned int i;
  26. std::set<std::string> excludes;
  27. for(i=0; i<args.size(); i++)
  28. {
  29. if (excludeFiles)
  30. {
  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. 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. // Loop over each build directory listed in the arguments. Each
  63. // directory has a cache file.
  64. for(i=0; i<args.size(); i++)
  65. {
  66. if ((args[i] == "EXCLUDE") || (args[i] == "INCLUDE_INTERNALS"))
  67. {
  68. break;
  69. }
  70. cmCacheManager::GetInstance()->LoadCache(args[i].c_str(), false,
  71. excludes, includes);
  72. }
  73. return true;
  74. }