cmForEachCommand.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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. #ifndef cmForEachCommand_h
  14. #define cmForEachCommand_h
  15. #include "cmStandardIncludes.h"
  16. #include "cmCommand.h"
  17. #include "cmFunctionBlocker.h"
  18. #include "cmListFileCache.h"
  19. /** \class cmForEachFunctionBlocker
  20. * \brief subclass of function blocker
  21. *
  22. *
  23. */
  24. class cmForEachFunctionBlocker : public cmFunctionBlocker
  25. {
  26. public:
  27. cmForEachFunctionBlocker() {m_Executing = false;}
  28. virtual ~cmForEachFunctionBlocker() {}
  29. virtual bool IsFunctionBlocked(const cmListFileFunction& lff,
  30. cmMakefile &mf);
  31. virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf);
  32. virtual void ScopeEnded(cmMakefile &mf);
  33. std::vector<std::string> m_Args;
  34. std::vector<cmListFileFunction> m_Functions;
  35. bool m_Executing;
  36. };
  37. /** \class cmForEachCommand
  38. * \brief starts an if block
  39. *
  40. * cmForEachCommand starts an if block
  41. */
  42. class cmForEachCommand : public cmCommand
  43. {
  44. public:
  45. /**
  46. * This is a virtual constructor for the command.
  47. */
  48. virtual cmCommand* Clone()
  49. {
  50. return new cmForEachCommand;
  51. }
  52. /**
  53. * This is called when the command is first encountered in
  54. * the CMakeLists.txt file.
  55. */
  56. virtual bool InitialPass(std::vector<std::string> const& args);
  57. /**
  58. * This determines if the command gets propagated down
  59. * to makefiles located in subdirectories.
  60. */
  61. virtual bool IsInherited() {return true;}
  62. /**
  63. * The name of the command as specified in CMakeList.txt.
  64. */
  65. virtual const char* GetName() { return "FOREACH";}
  66. /**
  67. * Succinct documentation.
  68. */
  69. virtual const char* GetTerseDocumentation()
  70. {
  71. return "start a foreach loop";
  72. }
  73. /**
  74. * More documentation.
  75. */
  76. virtual const char* GetFullDocumentation()
  77. {
  78. return
  79. "FOREACH (define arg1 arg2 arg2) Starts a foreach block.";
  80. }
  81. cmTypeMacro(cmForEachCommand, cmCommand);
  82. };
  83. #endif