diff options
author | Kitware Robot <kwrobot@kitware.com> | 2013-10-15 15:17:36 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-10-15 18:12:03 (GMT) |
commit | f051814ed0e63badbfd68049354f36259dbf4b49 (patch) | |
tree | f4e6f885f86c882d723a7dd53d2b702d0c7fdffb /Help/command/foreach.rst | |
parent | e94958e99c4dec26c86ce8b76d744c04ba960675 (diff) | |
download | CMake-f051814ed0e63badbfd68049354f36259dbf4b49.zip CMake-f051814ed0e63badbfd68049354f36259dbf4b49.tar.gz CMake-f051814ed0e63badbfd68049354f36259dbf4b49.tar.bz2 |
Convert builtin help to reStructuredText source files
Run the convert-help.bash script to convert documentation:
./convert-help.bash "/path/to/CMake-build/bin"
Then remove it.
Diffstat (limited to 'Help/command/foreach.rst')
-rw-r--r-- | Help/command/foreach.rst | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Help/command/foreach.rst b/Help/command/foreach.rst new file mode 100644 index 0000000..9ac70b3 --- /dev/null +++ b/Help/command/foreach.rst @@ -0,0 +1,46 @@ +foreach +------- + +Evaluate a group of commands for each value in a list. + +:: + + foreach(loop_var arg1 arg2 ...) + COMMAND1(ARGS ...) + COMMAND2(ARGS ...) + ... + endforeach(loop_var) + +All commands between foreach and the matching endforeach are recorded +without being invoked. Once the endforeach is evaluated, the recorded +list of commands is invoked once for each argument listed in the +original foreach command. Before each iteration of the loop +"${loop_var}" will be set as a variable with the current value in the +list. + +:: + + foreach(loop_var RANGE total) + foreach(loop_var RANGE start stop [step]) + +Foreach can also iterate over a generated range of numbers. There are +three types of this iteration: + +* When specifying single number, the range will have elements 0 to +"total". + +* When specifying two numbers, the range will have elements from the +first number to the second number. + +* The third optional number is the increment used to iterate from the +first number to the second number. + +:: + + foreach(loop_var IN [LISTS [list1 [...]]] + [ITEMS [item1 [...]]]) + +Iterates over a precise list of items. The LISTS option names +list-valued variables to be traversed, including empty elements (an +empty string is a zero-length list). The ITEMS option ends argument +parsing and includes all arguments following it in the iteration. |