switch

Description

Switch can be used inside a command to add different arguments depending on the value of an attribute in the launching task. Exactly what attributes are available depends on attributes of the launching task. The attribute must be set in the calling task.

Parameters

Attribute Description Required
attribute The attribute in the launching task to test against the case-branches
Yes.

Parameters specified as nested elements

case

Specify one case-element for every test to make. At most one case statement can match. If  no case matches, the default statement is used.

default

This will be used if no other case matches. Note that this element is optional if there are matching case-statements for all values. When no case-statement matches a default-element must be present or the build will fail with an error.

Examples

For example, inside a command for a compiler:

<switch attribute="debug">
<case value="true">
<arg value="/D_DEBUG"/>
</case>
<case value="false">
<arg></arg>
</case>
</switch>
Note that the above example really is an if-statement in disguise.