cmVariableWatchCommand.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 cmVariableWatchCommand_h
  4. #define cmVariableWatchCommand_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <set>
  7. #include <string>
  8. #include <vector>
  9. #include "cmCommand.h"
  10. class cmExecutionStatus;
  11. /** \class cmVariableWatchCommand
  12. * \brief Watch when the variable changes and invoke command
  13. *
  14. */
  15. class cmVariableWatchCommand : public cmCommand
  16. {
  17. public:
  18. /**
  19. * This is a virtual constructor for the command.
  20. */
  21. cmCommand* Clone() override { return new cmVariableWatchCommand; }
  22. //! Default constructor
  23. cmVariableWatchCommand();
  24. //! Destructor.
  25. ~cmVariableWatchCommand() override;
  26. /**
  27. * This is called when the command is first encountered in
  28. * the CMakeLists.txt file.
  29. */
  30. bool InitialPass(std::vector<std::string> const& args,
  31. cmExecutionStatus& status) override;
  32. /** This command does not really have a final pass but it needs to
  33. stay alive since it owns variable watch callback information. */
  34. bool HasFinalPass() const override { return true; }
  35. protected:
  36. std::set<std::string> WatchedVariables;
  37. };
  38. #endif