cmFunctionCommand.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 cmFunctionCommand_h
  4. #define cmFunctionCommand_h
  5. #include "cmCommand.h"
  6. #include "cmFunctionBlocker.h"
  7. class cmFunctionFunctionBlocker : public cmFunctionBlocker
  8. {
  9. public:
  10. cmFunctionFunctionBlocker() { this->Depth = 0; }
  11. ~cmFunctionFunctionBlocker() CM_OVERRIDE {}
  12. bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf,
  13. cmExecutionStatus&) CM_OVERRIDE;
  14. bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) CM_OVERRIDE;
  15. std::vector<std::string> Args;
  16. std::vector<cmListFileFunction> Functions;
  17. int Depth;
  18. };
  19. /// Starts function() ... endfunction() block
  20. class cmFunctionCommand : public cmCommand
  21. {
  22. public:
  23. /**
  24. * This is a virtual constructor for the command.
  25. */
  26. cmCommand* Clone() CM_OVERRIDE { return new cmFunctionCommand; }
  27. /**
  28. * This is called when the command is first encountered in
  29. * the CMakeLists.txt file.
  30. */
  31. bool InitialPass(std::vector<std::string> const& args,
  32. cmExecutionStatus& status) CM_OVERRIDE;
  33. /**
  34. * This determines if the command is invoked when in script mode.
  35. */
  36. bool IsScriptable() const CM_OVERRIDE { return true; }
  37. /**
  38. * The name of the command as specified in CMakeList.txt.
  39. */
  40. std::string GetName() const CM_OVERRIDE { return "function"; }
  41. cmTypeMacro(cmFunctionCommand, cmCommand);
  42. };
  43. #endif