cmForEachCommand.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 cmForEachCommand_h
  4. #define cmForEachCommand_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 cmForEachFunctionBlocker : public cmFunctionBlocker
  14. {
  15. public:
  16. cmForEachFunctionBlocker(cmMakefile* mf);
  17. ~cmForEachFunctionBlocker() override;
  18. bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf,
  19. cmExecutionStatus&) override;
  20. bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) override;
  21. std::vector<std::string> Args;
  22. std::vector<cmListFileFunction> Functions;
  23. private:
  24. cmMakefile* Makefile;
  25. int Depth;
  26. };
  27. /// Starts foreach() ... endforeach() block
  28. class cmForEachCommand : public cmCommand
  29. {
  30. public:
  31. /**
  32. * This is a virtual constructor for the command.
  33. */
  34. cmCommand* Clone() override { return new cmForEachCommand; }
  35. /**
  36. * This is called when the command is first encountered in
  37. * the CMakeLists.txt file.
  38. */
  39. bool InitialPass(std::vector<std::string> const& args,
  40. cmExecutionStatus& status) override;
  41. private:
  42. bool HandleInMode(std::vector<std::string> const& args);
  43. };
  44. #endif