cmVariableWatchCommand.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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"
  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() CM_OVERRIDE { return new cmVariableWatchCommand; }
  22. //! Default constructor
  23. cmVariableWatchCommand();
  24. //! Destructor.
  25. ~cmVariableWatchCommand() CM_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) CM_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 CM_OVERRIDE { return true; }
  35. /**
  36. * The name of the command as specified in CMakeList.txt.
  37. */
  38. std::string GetName() const CM_OVERRIDE { return "variable_watch"; }
  39. protected:
  40. std::set<std::string> WatchedVariables;
  41. };
  42. #endif