Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#30 Extend <compilerarg> type to support whole argument lines.

open
nobody
cpptasks (19)
5
2005-02-03
2005-02-03
Olaf David
No

The <compilerarg> type should have an optional
boolean attribute 'line'. It indicates,
that the 'value' attribute contains more than just one
compiler argument. Such arguments are delimited
by spaces.

As supposed to use

<compilerarg value="-u"/>
<compilerarg value="-Wimplicit"/>
<compilerarg value="-fnoautomatic"/>

it could be simpler by setting the 'line' attribute:

<compilerarg line="true" value="-u -Wimplicit
-fnoautomatic"/>

- Without specifying the 'line' attribute the current
behavior is provided (quoting the whole argument if
there are spaces).
- By using the the 'line' attribute the 'value' string
gets tokenized, each token becomes an argument.
- Only the space should used as delimiter, no regular
expression as suggested somewhere else, since compiler
line options are usually designed to use spaces as
delimiter.
- Another advantage: compiler arguments can be managed
in a <property> as a whole.

example:

<property name="FTN.flags" value="-u -Wimplicit
-fnoautomatic"/>

...
<compilerarg line="true" value="${FTN.flags}"/>
...

Adjusting a compiler or linker flag woud only require
changing a property value but not the task itself.
Such a property can also be stored externally and
just sourced in.

example:
file build.properties:
...
FTN.flags = -u -Wimplicit -fnoautomatic
...

file build.xml
<property file="build.properties">
...
<compilerarg line="true" value="${FTN.flags}"/>
...

I do have a modified version of 'cpptask', which
implements
the described behavior, I'd be happy to contribute this.

Discussion