I'm trying to provide all *.cpp files in a folder to the c++ compiler through ant. But I get no further than ant giving gpp a giant string containing all the files. I tried to prove it by using a small test application:
int main( int argc, char**args ){
for( --argc; argc != 0; --argc ) printf("arg[%d]: %s\n",argc,args[argc]);
}
With the ant script like this:
<target name="cmdline">
<fileset id="fileset" dir=".">
<include name="*"/>
</fileset>
<pathconvert refid="fileset" property="converted"/>
<exec executable="a.exe">
<arg value="${converted}"/>
</exec>
</target>
My a.exe's output is this:
[exec] arg[1]: .a.cpp.swp .build.xml.swp a.cpp a.exe build.xml
Now here's the question: how do I provide all files in the fileset individually as an argument to the executable?
This is what the apply task in ANT was designed to support.
For example:
<target name="cmdline">
<apply executable="a.exe" parallel="true">
<srcfile/>
<fileset dir="." includes="*.cpp"/>
</apply>
</target>
The parallel argument runs the program once using all the files as arguments.