compiler args (cpptasks)

  • AllenABQ

    AllenABQ - 2007-03-20

    I'm relatively new to Ant, but am having a great time exploring CPPTASKS.  It will be very useful for our dept project.

    My question centers around defining global some global flags for the compiler.  Can anyone provide an example of this?

    For instance, I want to use g++ and always have -Wall and -Wno-ununsed-parameter.

    I'm assuming there's a way I can do this with refid??, but not certain.

    Something like...

    <cc debug="true" outfile="${bin}/math" outtype="static">
      <compiler refid="[inserts the g++ for name and the compiler args]" />

    Any help appreciated.


    • Caleb Cittadino

      Caleb Cittadino - 2007-05-15

      Not sure what exactly you are asking here.  If you just want global compiler arguments then use a `compilerarg` tag as a direct child of the `cc` tag.

      Is this what you need?


      • Curt Arnold

        Curt Arnold - 2007-05-16

        Do something like:

             <!--  define a compiler that can be ref'd or extended   -->
             <compiler id="gcc-default" name="gcc">
                    <compilerarg value="-foo"/>

                   <cc ...>
                        <!-- if you just want to use the default  -->
                        <compiler refid="gcc-default"/>
                    <cc ...>
                          <compiler extends="gcc-default">

        See samples/xerces.ant for some examples of using extends.


Log in to post a comment.