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.


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

Parameters specified as nested elements


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.


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.


For example, inside a command for a compiler:

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