for Configuration File Directive

The for directive provides the ability to repeat a block of directives, assigning a different string data element value to a variable on each iteration of the loop.

This diagram shows the syntax of the for directive:

The for directive has the following parameters:

local_variable
This parameter must be a local variable that does not yet exist in the configuration file. It is assigned values from the string_list, one at a time. You cannot explicitly assign a value to this variable inside the directive block. The following lines demonstrate the restrictions that apply to this parameter:

x = "a"
for x in "b", "c", "d" // error, x has already been defined
{
   x = "d"             // error, assignment to x not allowed
}

string_list
This parameter is a list of strings. Each string is assigned to the variable in the order in which it appears in the list.

directive_block
This parameter is a set of subdirectives that is processed every time the variable takes a value from the string list. Usually the value of the variable is used by the directives in this block.

For example, the following directive copies files a.c to a.cpp, b.c to b.cpp, and c.c to c.cpp:

for x in "a", "b", "c"  {
   run "copy "x".c " x".cpp"
}


Configuration Files
How Configuration Files Are Processed


Change a Build Setup
Build


Configuration File Directives
Build Options