ENH: put the 64 bit paths first
[cmake.git] / Source / cmForEachCommand.h
blob5ef7b48093205ff1d1808b2eacb8c9c6bb17cd29
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmForEachCommand.h,v $
5 Language: C++
6 Date: $Date: 2009-03-17 19:10:15 $
7 Version: $Revision: 1.22 $
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 cmForEachCommand_h
18 #define cmForEachCommand_h
20 #include "cmCommand.h"
21 #include "cmFunctionBlocker.h"
22 #include "cmListFileCache.h"
24 /** \class cmForEachFunctionBlocker
25 * \brief subclass of function blocker
29 class cmForEachFunctionBlocker : public cmFunctionBlocker
31 public:
32 cmForEachFunctionBlocker() {this->Depth = 0;}
33 virtual ~cmForEachFunctionBlocker() {}
34 virtual bool IsFunctionBlocked(const cmListFileFunction& lff,
35 cmMakefile &mf,
36 cmExecutionStatus &);
37 virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf);
39 std::vector<std::string> Args;
40 std::vector<cmListFileFunction> Functions;
41 private:
42 int Depth;
45 /** \class cmForEachCommand
46 * \brief starts an if block
48 * cmForEachCommand starts an if block
50 class cmForEachCommand : public cmCommand
52 public:
53 /**
54 * This is a virtual constructor for the command.
56 virtual cmCommand* Clone()
58 return new cmForEachCommand;
61 /**
62 * This is called when the command is first encountered in
63 * the CMakeLists.txt file.
65 virtual bool InitialPass(std::vector<std::string> const& args,
66 cmExecutionStatus &status);
68 /**
69 * This determines if the command is invoked when in script mode.
71 virtual bool IsScriptable() { return true; }
73 /**
74 * The name of the command as specified in CMakeList.txt.
76 virtual const char* GetName() { return "foreach";}
78 /**
79 * Succinct documentation.
81 virtual const char* GetTerseDocumentation()
83 return "Evaluate a group of commands for each value in a list.";
86 /**
87 * More documentation.
89 virtual const char* GetFullDocumentation()
91 return
92 " foreach(loop_var arg1 arg2 ...)\n"
93 " COMMAND1(ARGS ...)\n"
94 " COMMAND2(ARGS ...)\n"
95 " ...\n"
96 " endforeach(loop_var)\n"
97 "All commands between foreach and the matching endforeach are recorded "
98 "without being invoked. Once the endforeach is evaluated, the "
99 "recorded list of commands is invoked once for each argument listed "
100 "in the original foreach command. Before each iteration of the loop "
101 "\"${loop_var}\" will be set as a variable with "
102 "the current value in the list.\n"
103 " foreach(loop_var RANGE total)\n"
104 " foreach(loop_var RANGE start stop [step])\n"
105 "Foreach can also iterate over a generated range of numbers. "
106 "There are three types of this iteration:\n"
107 "* When specifying single number, the range will have elements "
108 "0 to \"total\".\n"
109 "* When specifying two numbers, the range will have elements from "
110 "the first number to the second number.\n"
111 "* The third optional number is the increment used to iterate from "
112 "the first number to the second number."
113 "\n"
114 " foreach(loop_var IN [LISTS [list1 [...]]]\n"
115 " [ITEMS [item1 [...]]])\n"
116 "Iterates over a precise list of items. "
117 "The LISTS option names list-valued variables to be traversed, "
118 "including empty elements (an empty string is a zero-length list). "
119 "The ITEMS option ends argument parsing and includes all arguments "
120 "following it in the iteration."
124 cmTypeMacro(cmForEachCommand, cmCommand);
125 private:
126 bool HandleInMode(std::vector<std::string> const& args);
130 #endif