Execute a command with arguments. This is used inside a compiler, staticlibrarylinker, dynamiclibrarylinker 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. |
Yes. |
<command file="g++">This will run the command "g++" found on the PATH with the sourcefiles from the launching task (a compile task).
<arglist name="srcfiles"/>
</command>
<command file="ar">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).
<arg value="rvs"/>
<value attribute="output" prefix="lib" suffix=".a "/>
<arglist name="objfiles"/>
</command>
<ommand file="cl.exe">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:
<arg value="/nologo"/>
<arg value="/EHsc"/>
<arglist name="srcfiles"/>
</command>
<ommand file="cl.exe">
<arg value="/nologo /EHsc"/>
<arglist name="srcfiles"/>
</command>
<ommand file="cl.exe /nologo /EHsc">
<arglist name="srcfiles"/>
</command>
<ommand file="mv *.o x86"/>