cmWhileCommand.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmWhileCommand_h
  4. #define cmWhileCommand_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <string>
  7. #include <vector>
  8. #include "cmCommand.h"
  9. #include "cmFunctionBlocker.h"
  10. #include "cmListFileCache.h"
  11. class cmExecutionStatus;
  12. class cmMakefile;
  13. class cmWhileFunctionBlocker : public cmFunctionBlocker
  14. {
  15. public:
  16. cmWhileFunctionBlocker(cmMakefile* mf);
  17. ~cmWhileFunctionBlocker() override;
  18. bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf,
  19. cmExecutionStatus&) override;
  20. bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) override;
  21. std::vector<cmListFileArgument> Args;
  22. std::vector<cmListFileFunction> Functions;
  23. private:
  24. cmMakefile* Makefile;
  25. int Depth;
  26. };
  27. /// \brief Starts a while loop
  28. class cmWhileCommand : public cmCommand
  29. {
  30. public:
  31. /**
  32. * This is a virtual constructor for the command.
  33. */
  34. cmCommand* Clone() override { return new cmWhileCommand; }
  35. /**
  36. * This overrides the default InvokeInitialPass implementation.
  37. * It records the arguments before expansion.
  38. */
  39. bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
  40. cmExecutionStatus&) override;
  41. /**
  42. * This is called when the command is first encountered in
  43. * the CMakeLists.txt file.
  44. */
  45. bool InitialPass(std::vector<std::string> const&,
  46. cmExecutionStatus&) override
  47. {
  48. return false;
  49. }
  50. };
  51. #endif