Boost logo

Boost-Build :

Subject: Re: [Boost-build] cxxflags depending on tooslet and version?
From: Juraj Ivanèiæ (juraj.ivancic_at_[hidden])
Date: 2012-03-28 16:18:33


On 28.3.2012. 19:49, Oliver Kowalke wrote:
> I need to define a pre-processor macro (BOOST_USE_SPLIT_STACK) and apply
> a command line option for gcc (<cxxflags>-fsplit_stack) depending for
> gcc version greater/equal to gcc-2.6 in the Jamfile!
> How can I do this?
>
> <toolset>gcc,<version> > 2.6:<define>BOOST_USE_SPLIT_STACK
> <toolset>gcc,<version> > 2.6:<cxxflags>-fsplit_stack

Equal is easy:

<toolset>gcc,<toolset-gcc:version>2.6:<define>BOOST_USE_SPLIT_STACK
<toolset>gcc,<toolset-gcc:version>2.6:<cxxflags>-fsplit_stack

For greater you probably need to use <conditional>:

rule split-stack-cond ( properties * )
{
   local toolset = [ MATCH <toolset>(.*) : $(properties) ] ;
   if $(toolset) = gcc
   {
     local gcc-ver = [ MATCH <toolset-gcc:version>(.*) : $(properties) ] ;
     local major = [ MATCH (.)\..* : $(gcc-ver) ] ;
     local minor = [ MATCH .\.(.).* : $(gcc-ver) ] ;

     if $(major) > 2 | ( $(major) = 2 & $(minor) >= 6 )
     {
         return <define>BOOST_USE_SPLIT_STACK <cxxflags>-fsplit_stack ;
     }
   }
}

lib target : : <conditional>@split-stack-cond ;

HTH


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