|
Boost : |
Subject: Re: [boost] [predef] Using predef-require with OR conditions
From: Rene Rivera (grafikrobot_at_[hidden])
Date: 2015-05-04 00:43:04
On Sun, May 3, 2015 at 9:41 PM, Edward Diener <eldiener_at_[hidden]>
wrote:
> On 5/3/2015 9:29 PM, Rene Rivera wrote:
>
>> On Sun, May 3, 2015 at 4:55 PM, Edward Diener <eldiener_at_[hidden]>
>> wrote:
>>
>> In a jamfile I would like to use predef-require in OR situatuations so
>>> that if any particular predef-definition is true my unit testing rule
>>> occurs, else it does not occur:
>>>
>>> import ../libs/predef/check/predef : require : predef-require ;
>>>
>>> run some_test.cpp : : : BOOST_COMP_SOME_COMPILER >= n.n.n ||
>>> other_predef_definiion ;
>>>
>>> The typical use case for this is to have a unit test for particular
>>> version(s) of a compiler or for all other versions of other compilers.
>>>
>>> Is this possible ?
>>>
>>>
>> It is possible, and it came up when I first introduced the feature, with
>> some basic De Morgan's application:
>>
>> run some_test.cpp : : : [ predef-require "BOOST_COMP_SOME_COMPILER <
>> n.n.n"
>> "other_predef_def_negated" ] ;
>>
>
> I do not see how this can work. Let's say I want to run some_test.cpp when
> either BOOST_COMP_SOME_COMPILER is version n.n.n or above OR when
> BOOST_COMP_SOME_COMPILER is not being used at all, ie.
> BOOST_COMP_SOME_COMPILER is equal to 0. How can that be done ?
Oops. I forgot that you would need to use the check rule, not the require
rule:
[ predef-check "BCSC != 0" "BCSC < n.n.n" : <build>no ]
Which says: when BCSC is not 0 *and* BCSC < n.n.n, do not build/run. And
hence, by De Morgan's, also says: when BCSC is 0 *or* BCSC >= n.n.n,
build/run it.
HTH
-- -- Rene Rivera -- Grafik - Don't Assume Anything -- Robot Dreams - http://robot-dreams.net -- rrivera/acm.org (msn) - grafikrobot/aim,yahoo,skype,efnet,gmail
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk