1 /*=========================================================================
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: cmForEachCommand.h,v $
6 Date: $Date: 2002-07-17 14:48:05 $
7 Version: $Revision: 1.5 $
9 Copyright (c) 2002 Insight Consortium. All rights reserved.
10 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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 cmForEachCommand_h
18 #define cmForEachCommand_h
20 #include "cmStandardIncludes.h"
21 #include "cmCommand.h"
22 #include "cmFunctionBlocker.h"
24 /** \class cmForEachFunctionBlocker
25 * \brief subclass of function blocker
29 class cmForEachFunctionBlocker
: public cmFunctionBlocker
32 cmForEachFunctionBlocker() {m_Executing
= false;}
33 virtual ~cmForEachFunctionBlocker() {}
34 virtual bool IsFunctionBlocked(const char *name
,
35 const std::vector
<std::string
> &args
,
37 virtual bool ShouldRemove(const char *name
,
38 const std::vector
<std::string
> &args
,
40 virtual void ScopeEnded(cmMakefile
&mf
);
42 virtual int NeedExpandedVariables () { return 0; };
44 std::vector
<std::string
> m_Args
;
45 std::vector
<std::string
> m_Commands
;
46 std::vector
<std::vector
<std::string
> > m_CommandArguments
;
50 /** \class cmForEachCommand
51 * \brief starts an if block
53 * cmForEachCommand starts an if block
55 class cmForEachCommand
: public cmCommand
59 * This is a virtual constructor for the command.
61 virtual cmCommand
* Clone()
63 return new cmForEachCommand
;
67 * This is called when the command is first encountered in
68 * the CMakeLists.txt file.
70 virtual bool InitialPass(std::vector
<std::string
> const& args
);
73 * This determines if the command gets propagated down
74 * to makefiles located in subdirectories.
76 virtual bool IsInherited() {return true;}
79 * The name of the command as specified in CMakeList.txt.
81 virtual const char* GetName() { return "FOREACH";}
84 * Succinct documentation.
86 virtual const char* GetTerseDocumentation()
88 return "start a foreach loop";
94 virtual const char* GetFullDocumentation()
97 "FOREACH (define arg1 arg2 arg2) Starts a foreach block.";
100 cmTypeMacro(cmForEachCommand
, cmCommand
);