cmMacroCommand.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmMacroCommand_h
  14. #define cmMacroCommand_h
  15. #include "cmStandardIncludes.h"
  16. #include "cmCommand.h"
  17. #include "cmFunctionBlocker.h"
  18. /** \class cmMacroFunctionBlocker
  19. * \brief subclass of function blocker
  20. *
  21. *
  22. */
  23. class cmMacroFunctionBlocker : public cmFunctionBlocker
  24. {
  25. public:
  26. cmMacroFunctionBlocker() {m_Executing = false;}
  27. virtual ~cmMacroFunctionBlocker() {}
  28. virtual bool IsFunctionBlocked(const char *name,
  29. const std::vector<std::string> &args,
  30. cmMakefile &mf);
  31. virtual bool ShouldRemove(const char *name,
  32. const std::vector<std::string> &args,
  33. cmMakefile &mf);
  34. virtual void ScopeEnded(cmMakefile &mf);
  35. virtual int NeedExpandedVariables () { return 0; };
  36. std::vector<std::string> m_Args;
  37. std::vector<std::string> m_Commands;
  38. std::vector<std::vector<std::string> > m_CommandArguments;
  39. bool m_Executing;
  40. };
  41. /** \class cmMacroCommand
  42. * \brief starts an if block
  43. *
  44. * cmMacroCommand starts an if block
  45. */
  46. class cmMacroCommand : public cmCommand
  47. {
  48. public:
  49. /**
  50. * This is a virtual constructor for the command.
  51. */
  52. virtual cmCommand* Clone()
  53. {
  54. return new cmMacroCommand;
  55. }
  56. /**
  57. * This is called when the command is first encountered in
  58. * the CMakeLists.txt file.
  59. */
  60. virtual bool InitialPass(std::vector<std::string> const& args);
  61. /**
  62. * This determines if the command gets propagated down
  63. * to makefiles located in subdirectories.
  64. */
  65. virtual bool IsInherited() {return true;}
  66. /**
  67. * The name of the command as specified in CMakeList.txt.
  68. */
  69. virtual const char* GetName() { return "MACRO";}
  70. /**
  71. * Succinct documentation.
  72. */
  73. virtual const char* GetTerseDocumentation()
  74. {
  75. return "start defining a Macro.";
  76. }
  77. /**
  78. * More documentation.
  79. */
  80. virtual const char* GetFullDocumentation()
  81. {
  82. return
  83. "MACRO(name arg1 arg2 arg3 ...) Starts to define a macro named name that takes arguments named arg1 arg2 arg3... When the macro is invoked the actual arguments passed replace the formal arguments. ";
  84. }
  85. cmTypeMacro(cmMacroCommand, cmCommand);
  86. };
  87. #endif