cmFunctionCommand.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmFunctionCommand_h
  11. #define cmFunctionCommand_h
  12. #include "cmCommand.h"
  13. #include "cmFunctionBlocker.h"
  14. class cmFunctionFunctionBlocker : public cmFunctionBlocker
  15. {
  16. public:
  17. cmFunctionFunctionBlocker() {this->Depth=0;}
  18. virtual ~cmFunctionFunctionBlocker() {}
  19. virtual bool IsFunctionBlocked(const cmListFileFunction&,
  20. cmMakefile &mf,
  21. cmExecutionStatus &);
  22. virtual bool ShouldRemove(const cmListFileFunction&, cmMakefile &mf);
  23. std::vector<std::string> Args;
  24. std::vector<cmListFileFunction> Functions;
  25. int Depth;
  26. };
  27. /// Starts function() ... endfunction() block
  28. class cmFunctionCommand : public cmCommand
  29. {
  30. public:
  31. /**
  32. * This is a virtual constructor for the command.
  33. */
  34. virtual cmCommand* Clone()
  35. {
  36. return new cmFunctionCommand;
  37. }
  38. /**
  39. * This is called when the command is first encountered in
  40. * the CMakeLists.txt file.
  41. */
  42. virtual bool InitialPass(std::vector<std::string> const& args,
  43. cmExecutionStatus &status);
  44. /**
  45. * This determines if the command is invoked when in script mode.
  46. */
  47. virtual bool IsScriptable() const { return true; }
  48. /**
  49. * The name of the command as specified in CMakeList.txt.
  50. */
  51. virtual const char* GetName() const { return "function";}
  52. cmTypeMacro(cmFunctionCommand, cmCommand);
  53. };
  54. #endif