Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#241 Compilerarg with "if" attributes are never added

open
Curt Arnold
cpptasks (103)
5
2010-07-03
2010-07-03
Russell Bolles
No

It seems that if you have an if attribute for your compilerarg task, the compilerarg will not be added if it evaluates to true. Running on Linux Red Hat 5, gcc441. The following cc task:
<cpptasks:cc outtype="static" subsystem="console" outfile="${AUTO_LIB_DIR}/${LIB_NAME}" objdir="${AUTO_OBJ_DIR}" rebuild="true" name="gcc">
<compilerarg location="start" value="${POSIX_1G_FLAG}" if="${POSIX_1G}" />
<compilerarg location="start" value="${EXTENSIONS_FLAG}" />
<compilerarg location="start" value="${SOLARIS_FLAG}" if="${SOLARIS}" />
<compilerarg location="start" value="${USE_BSD_FLAG}" if="${USE_BSD}" />
<compilerarg location="start" value="${PEDANTIC_FLAG}" />
<compilerarg location="start" value="${WARNING_ALL_FLAG}" />
<compilerarg location="start" value="${OPTIMIZE_2_FLAG}" if="${OPTIMIZE_2}" />
<fileset dir="${AUTO_SRC_DIR}" includes="**/*.c" />
<includepath path="${AUTO_INC_DIR}" />
<includepath path="${MFST_INC}" />
</cpptasks:cc>

Results in the following log statements:
>>> TASK STARTED -- org.apache.tools.ant.UnknownElement@1462851
--- MESSAGE LOGGED
Condition true; setting POSIX_1G to true
--- MESSAGE LOGGED
Setting project property: POSIX_1G -> true
<<< TASK FINISHED -- org.apache.tools.ant.UnknownElement@1462851
>>> TASK STARTED -- org.apache.tools.ant.UnknownElement@10045eb
--- MESSAGE LOGGED
Condition true; setting USE_BSD to true
--- MESSAGE LOGGED
Setting project property: USE_BSD -> true
<<< TASK FINISHED -- org.apache.tools.ant.UnknownElement@10045eb
...
[cpptasks:cc] 381 total files to be compiled.
--- MESSAGE LOGGED
[cpptasks:cc] gcc -D__EXTENSIONS__ -pedantic -Wall -c -I<Include and Src Files Follow>
--- MESSAGE LOGGED
Execute:Java13CommandLauncher: Executing 'gcc' with arguments:
'-D__EXTENSIONS__'
'-pedantic'
'-Wall'
'-c'

No -D__USE_BSD or -DPOSIX_1G or -O2. :-( Am I doing something wrong?

Discussion