Boost logo

Boost-Build :

Subject: Re: [Boost-build] switching on toolset
From: Rene Rivera (grafikrobot_at_[hidden])
Date: 2015-06-17 11:10:26


On Wed, Jun 17, 2015 at 10:06 AM, Edward Diener <eldiener_at_[hidden]>
wrote:

> On 6/17/2015 12:01 AM, Gennadiy Rozental wrote:
>
>> Edward Diener <eldiener <at> tropicsoft.com> writes:
>>
>> Look at predef-check and predef-require in the Boost predef library. It
>>> is still a bit buggy but it is what you want.
>>>
>>
>> I do not understand how to use these or what they are doing.
>>
>> For now , what I need is rather simple. If toolset is gcc with version
>> less
>> then equal to 4.6 add std=c++0x otherwise add std=c++11.
>>
>> How would I express this using the rules you've mentioned?
>>
>
> At the top of your jamfile add:
>
> import your-path-to-predef/predef/check/predef : require check :
> predef-require predef-check ;
>
> In the requirements section of a rule invocation add:
>
> [ predef-check "BOOST_COMP_GNUC > 0" "BOOST_COMP_GNUC <= 4.6" : :
> <cxxflags>-std=c++0x : <cxxflags>-std=c++11 ]

Note.. That if you plan on having many targets use that it would be better
to no repeat it:

local c++lang-requirement = [ predef-check "BOOST_COMP_GNUC > 0"
"BOOST_COMP_GNUC <= 4.6" : : <cxxflags>-std=c++0x : <cxxflags>-std=c++11 ] ;

And add $(c++lang-requirement) to the target(s) requirements.

-- 
-- Rene Rivera
-- Grafik - Don't Assume Anything
-- Robot Dreams - http://robot-dreams.net
-- rrivera/acm.org (msn) - grafikrobot/aim,yahoo,skype,efnet,gmail


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