Boost logo

Boost-Build :

Subject: Re: [Boost-build] Checking for property values...
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-01-05 12:59:16


AMDG

Brian Ravnsgaard Riis wrote:
> Given
>
> if [ property.select <some_feature> : $(properties) ] in
> value1 value2 value3 and_so_on
> {
> ...
> }
>
> The ... part gets evaluated if <some_feature> has a value in the list,
> but also, it seems, if <some_feature> is not present in properties at
> all. Is this intentional? I need the branch to execute only if
> <some_feature> is present *and* is one of value1 value2 etc.
>

This is an artifact of the way "in" works:

>From
http://www.boost.org/doc/tools/jam/jam/language.html#jam.language.flow_of_control

|/a/ in /b/|

    true if all elements of /a/ can be found in /b/, or if /a/ has no
    elements

The easiest way around this is to create a named variable:

local values = [ property.select ... ] ;
if $(values)-is-defined && $(values) in value1 value2 ... {
}

In Christ,
Steven Watanabe


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