BUG: Fix find_* search order with path suffixes
[cmake.git] / Source / cmMacroCommand.h
blobeac10e07dc4212b49b88a6ce40303700c81685bc
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmMacroCommand.h,v $
5 Language: C++
6 Date: $Date: 2008-01-23 15:27:59 $
7 Version: $Revision: 1.16 $
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);
37 virtual void ScopeEnded(cmMakefile &mf);
39 std::vector<std::string> Args;
40 std::vector<cmListFileFunction> Functions;
41 int Depth;
44 /** \class cmMacroCommand
45 * \brief starts an if block
47 * cmMacroCommand starts an if block
49 class cmMacroCommand : public cmCommand
51 public:
52 /**
53 * This is a virtual constructor for the command.
55 virtual cmCommand* Clone()
57 return new cmMacroCommand;
60 /**
61 * This is called when the command is first encountered in
62 * the CMakeLists.txt file.
64 virtual bool InitialPass(std::vector<std::string> const& args,
65 cmExecutionStatus &status);
67 /**
68 * This determines if the command is invoked when in script mode.
70 virtual bool IsScriptable() { return true; }
72 /**
73 * The name of the command as specified in CMakeList.txt.
75 virtual const char* GetName() { return "macro";}
77 /**
78 * Succinct documentation.
80 virtual const char* GetTerseDocumentation()
82 return "Start recording a macro for later invocation as a command.";
85 /**
86 * More documentation.
88 virtual const char* GetFullDocumentation()
90 return
91 " macro(<name> [arg1 [arg2 [arg3 ...]]])\n"
92 " COMMAND1(ARGS ...)\n"
93 " COMMAND2(ARGS ...)\n"
94 " ...\n"
95 " endmacro(<name>)\n"
96 "Define a macro named <name> that takes arguments named "
97 "arg1 arg2 arg3 (...). Commands listed after macro, "
98 "but before the matching endmacro, are not invoked until the macro "
99 "is invoked. When it is invoked, the commands recorded in the "
100 "macro are first modified by replacing formal parameters (${arg1}) "
101 "with the arguments passed, and then invoked as normal commands. In "
102 "addition to referencing the formal parameters you can reference "
103 "the values ${ARGC} which will be set to the number of arguments "
104 "passed into the function as well as ${ARGV0} ${ARGV1} ${ARGV2} "
105 "... which "
106 "will have the actual values of the arguments passed in. This "
107 "facilitates creating macros with optional arguments. Additionally "
108 "${ARGV} holds the list of all arguments given to the macro and "
109 "${ARGN} "
110 "holds the list of argument pass the last expected argument. "
111 "Note that the parameters to a macro and values such as ARGN "
112 "are not variables in the usual CMake sense. They are string "
113 "replacements much like the c preprocessor would do with a "
114 "macro. If you want true CMake variables you should look at "
115 "the function command.";
118 cmTypeMacro(cmMacroCommand, cmCommand);
122 #endif