1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmWhileCommand.h,v $
6 Date: $Date: 2009-01-21 14:48:20 $
7 Version: $Revision: 1.11 $
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 cmWhileCommand_h
18 #define cmWhileCommand_h
20 #include "cmCommand.h"
21 #include "cmFunctionBlocker.h"
22 #include "cmListFileCache.h"
24 /** \class cmWhileFunctionBlocker
25 * \brief subclass of function blocker
29 class cmWhileFunctionBlocker
: public cmFunctionBlocker
32 cmWhileFunctionBlocker() {this->Depth
=0;}
33 virtual ~cmWhileFunctionBlocker() {}
34 virtual bool IsFunctionBlocked(const cmListFileFunction
& lff
,
37 virtual bool ShouldRemove(const cmListFileFunction
& lff
, cmMakefile
&mf
);
39 std::vector
<cmListFileArgument
> Args
;
40 std::vector
<cmListFileFunction
> Functions
;
45 /** \class cmWhileCommand
46 * \brief starts a while loop
48 * cmWhileCommand starts a while loop
50 class cmWhileCommand
: public cmCommand
54 * This is a virtual constructor for the command.
56 virtual cmCommand
* Clone()
58 return new cmWhileCommand
;
62 * This overrides the default InvokeInitialPass implementation.
63 * It records the arguments before expansion.
65 virtual bool InvokeInitialPass(const std::vector
<cmListFileArgument
>& args
,
69 * This is called when the command is first encountered in
70 * the CMakeLists.txt file.
72 virtual bool InitialPass(std::vector
<std::string
> const&,
73 cmExecutionStatus
&) { return false; }
76 * This determines if the command is invoked when in script mode.
78 virtual bool IsScriptable() { return true; }
81 * The name of the command as specified in CMakeList.txt.
83 virtual const char* GetName() { return "while";}
86 * Succinct documentation.
88 virtual const char* GetTerseDocumentation()
90 return "Evaluate a group of commands while a condition is true";
96 virtual const char* GetFullDocumentation()
100 " COMMAND1(ARGS ...)\n"
101 " COMMAND2(ARGS ...)\n"
103 " endwhile(condition)\n"
104 "All commands between while and the matching endwhile are recorded "
105 "without being invoked. Once the endwhile is evaluated, the "
106 "recorded list of commands is invoked as long as the condition "
107 "is true. The condition is evaluated using the same logic as the "
111 cmTypeMacro(cmWhileCommand
, cmCommand
);