Boost logo

Boost-Build :

Subject: Re: [Boost-build] Target alternatives and multiple compilers - again
From: Jürgen Hunold (juergen.hunold_at_[hidden])
Date: 2011-07-12 06:18:09


Hi Edward,

On Monday, 11. July 2011 18:49:29 Edward Diener wrote:
> Ping !

Pong ;-))
 
> I need to use target alternatives with multiple compilers so I write, as
> part of my jamfile:
>
> test-suite somelib
>
> [ compile some_source.cpp ]
> ;
>
> test-suite somelib_gcc
>
> [ compile some_source.cpp
>
> : <cxxflags>-std=c++0x
> : some_source_gcc
>
> ]
>
> <toolset>gcc-4.3.0
> <toolset>gcc-4.4.0
> <toolset>gcc-4.5.0
> <toolset>gcc-4.5.2
> <toolset>gcc-4.6.0

This won't work.

You have to use:

 <toolset-gcc:version>4.3.0

to get this working.

A more stable solution would be to query the compile in a conditional rule.
I have the following requierements:

     # advanced compiler setup
        <conditional>@gcc-conditional

and my (shortened) conditinal rule looks like this:

rule gcc-conditional ( properties * )
{
    # Extract version number from toolset
    local version = [ MATCH "<toolset.*version>([0123456789]+)[.]
([0123456789]*)"
        : $(properties) ] ;

    local major = $(version[1]) ;
    local minor = $(version[2]) ;
    local result ;

    if $(major) = 4
    {
        if $(minor) < 5
        {
           result += <cxxflags>-Wno-strict-aliasing ;
           result += <cxxflags>-Wno-uninitialized ;
        }

}

So "result" will have the needed flags. For gcc < 4.3 you can add "<build>no"
to "result" and nothing gets built.
For more examples, use the Boost Jamfiles and tools/gcc.jam from
tools/build/v2.

Hope this helps.

Yours,

Jürgen

-- 
* Dipl.-Math. Jürgen Hunold       ! Ingenieurgesellschaft für 
* voice: ++49 511 262926 57       ! Verkehrs- und Eisenbahnwesen mbH  
* fax  : ++49 511 262926 99       ! Lister Straße 15
* juergen.hunold_at_[hidden]        ! www.ivembh.de
* 
* Geschäftsführer:                ! Sitz des Unternehmens: Hannover
* Prof. Dr.-Ing. Thomas Siefer    ! Amtsgericht Hannover, HRB 56965
* PD Dr.-Ing. Alfons Radtke       !

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk