cmLoadCacheCommand.cxx 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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;
  22. cmSystemTools::ExpandListArguments(argsIn, args);
  23. // Cache entries to be excluded from the import list.
  24. // If this set is empty, all cache entries are brought in
  25. // and they can not be overridden.
  26. bool excludeFiles=false;
  27. unsigned int i;
  28. std::set<std::string> excludes;
  29. for(i=0; i<args.size(); i++)
  30. {
  31. if (excludeFiles)
  32. {
  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. includes.insert(args[i]);
  54. }
  55. if (args[i] == "INCLUDE_INTERNALS")
  56. {
  57. includeFiles=true;
  58. }
  59. if (includeFiles && (args[i] == "EXCLUDE"))
  60. {
  61. break;
  62. }
  63. }
  64. // Loop over each build directory listed in the arguments. Each
  65. // directory has a cache file.
  66. for(i=0; i<args.size(); i++)
  67. {
  68. if ((args[i] == "EXCLUDE") || (args[i] == "INCLUDE_INTERNALS"))
  69. {
  70. break;
  71. }
  72. cmCacheManager::GetInstance()->LoadCache(args[i].c_str(), false,
  73. excludes, includes);
  74. }
  75. return true;
  76. }