Execute a command with arguments. This is used inside a compilerstaticlibrarylinkerdynamiclibrarylinker or loadablemodulelinker task. On a windows platform the command is executed directy, on all other platforms the command is started using sh -c '<command+commandline>'. This makes it more scriptlike and the commandline parsing will work as expected (expanding *, proper grouping of arguments, etc).

The arguemtns given as nested elements are not separated as arguments formally. They are just evaluated and added as text to the total command line. The command line parsing is left to the command interpreter (except under windows).

Note: The working directory in which the commands will be executed depends on the launching task. It will be the output directory or the directory in which the target file is to be placed. This behaviour is intended as a help because some tools can't specify an output directory for multiple object files.


Attribute Description Required
file This is the actual command to execute.  Specify either the full path, or rely on the command to be in the PATH environment variable.

Parameters specified as nested elements


Add constant arguments to the command line.


Add the value of an attribute from the launching task (compile, linklib or linkexe) to the command line.


Use a switch-tag to add different arguments depending on the value of an attribute from the laumching task.


Add a list supplied by the launching task to the command line.


<command file="g++">
<arglist name="srcfiles"/>
This will run the command "g++" found on the PATH with the sourcefiles from the launching task (a compile task).
<command file="ar">
<arg value="rvs"/>
<value attribute="output" prefix="lib" suffix=".a "/>
<arglist name="objfiles"/>
This is an example which uses three kind of argument-tags when putting together the commandline nescessairy to run the command ar (on the PATH).

The actual arguments are not formal arguments, this means that the following commands are all eqvivalent:
<ommand file="cl.exe">
<arg value="/nologo"/>
<arg value="/EHsc"/>
<arglist name="srcfiles"/>

<ommand file="cl.exe">
<arg value="/nologo /EHsc"/>
<arglist name="srcfiles"/>

<ommand file="cl.exe /nologo /EHsc">
<arglist name="srcfiles"/>
The last example which really exploits the fact that arguments are reparsed upon execution might be useful sometimes when just one simple command is needed for housekeeping functions:
<ommand file="mv *.o x86"/>