Menu

compiler args (cpptasks)

Help
AllenABQ
2007-03-20
2013-04-24
  • 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]" />
      ...
    </cc>

    Any help appreciated.

    -Allen

     
    • 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?

      ~Caleb

       
      • Curt Arnold

        Curt Arnold - 2007-05-16

        Do something like:

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

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

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

         

Log in to post a comment.