ENH: check in almost building VMS stuff with VMSBuild directory since the bootstrap...
[cmake.git] / Source / cmMacroCommand.h
blob05d1a4d0c07fa24e06a14b050584f34c8a8fbdab
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmMacroCommand.h,v $
5 Language: C++
6 Date: $Date: 2009-01-22 18:16:47 $
7 Version: $Revision: 1.18 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef cmMacroCommand_h
18 #define cmMacroCommand_h
20 #include "cmCommand.h"
21 #include "cmFunctionBlocker.h"
23 /** \class cmMacroFunctionBlocker
24 * \brief subclass of function blocker
28 class cmMacroFunctionBlocker : public cmFunctionBlocker
30 public:
31 cmMacroFunctionBlocker() {this->Depth=0;}
32 virtual ~cmMacroFunctionBlocker() {}
33 virtual bool IsFunctionBlocked(const cmListFileFunction&,
34 cmMakefile &mf,
35 cmExecutionStatus &);
36 virtual bool ShouldRemove(const cmListFileFunction&, cmMakefile &mf);
38 std::vector<std::string> Args;
39 std::vector<cmListFileFunction> Functions;
40 int Depth;
43 /** \class cmMacroCommand
44 * \brief starts an if block
46 * cmMacroCommand starts an if block
48 class cmMacroCommand : public cmCommand
50 public:
51 /**
52 * This is a virtual constructor for the command.
54 virtual cmCommand* Clone()
56 return new cmMacroCommand;
59 /**
60 * This is called when the command is first encountered in
61 * the CMakeLists.txt file.
63 virtual bool InitialPass(std::vector<std::string> const& args,
64 cmExecutionStatus &status);
66 /**
67 * This determines if the command is invoked when in script mode.
69 virtual bool IsScriptable() { return true; }
71 /**
72 * The name of the command as specified in CMakeList.txt.
74 virtual const char* GetName() { return "macro";}
76 /**
77 * Succinct documentation.
79 virtual const char* GetTerseDocumentation()
81 return "Start recording a macro for later invocation as a command.";
84 /**
85 * More documentation.
87 virtual const char* GetFullDocumentation()
89 return
90 " macro(<name> [arg1 [arg2 [arg3 ...]]])\n"
91 " COMMAND1(ARGS ...)\n"
92 " COMMAND2(ARGS ...)\n"
93 " ...\n"
94 " endmacro(<name>)\n"
95 "Define a macro named <name> that takes arguments named "
96 "arg1 arg2 arg3 (...). Commands listed after macro, "
97 "but before the matching endmacro, are not invoked until the macro "
98 "is invoked. When it is invoked, the commands recorded in the "
99 "macro are first modified by replacing formal parameters (${arg1}) "
100 "with the arguments passed, and then invoked as normal commands. In "
101 "addition to referencing the formal parameters you can reference "
102 "the values ${ARGC} which will be set to the number of arguments "
103 "passed into the function as well as ${ARGV0} ${ARGV1} ${ARGV2} "
104 "... which "
105 "will have the actual values of the arguments passed in. This "
106 "facilitates creating macros with optional arguments. Additionally "
107 "${ARGV} holds the list of all arguments given to the macro and "
108 "${ARGN} "
109 "holds the list of argument pass the last expected argument. "
110 "Note that the parameters to a macro and values such as ARGN "
111 "are not variables in the usual CMake sense. They are string "
112 "replacements much like the c preprocessor would do with a "
113 "macro. If you want true CMake variables you should look at "
114 "the function command."
115 "\n"
116 "See the cmake_policy() command documentation for the behavior of "
117 "policies inside macros."
121 cmTypeMacro(cmMacroCommand, cmCommand);
125 #endif