Boost logo

Boost-Build :

From: Joao Abecasis (jpabecasis_at_[hidden])
Date: 2004-12-01 06:49:14


Rene Rivera wrote:
> Joel wrote:
>
>> Joao Abecasis wrote:
>>

[snip]

>>> One note on some of the tweaks, though. From my patches you
>>> cannot rely on SPIRIT_HAVE_BOOST_THREADS,
>>> SPIRIT_HAVE_BOOST_REGEX, SPIRIT_NO_MINIBOOST to not being
>>> defined. The top level Jamrules explicitly sets them to the
>>> literal "FALSE".
>>>
>>> This was the "hack" I could come up with... How can I test if a
>>> variable is defined with bjam? All I found is that ?= will assign
>>> if a variable is not defined and both empty and undefined
>>> variables have a negative logical value.
>>
>>
>>
>> I guess we'll have to ask the Boost.Build guys. I cross posted
>> to the list.
>
>
> I'm guessing that by variable you mean environment variable..

Yes.

> Question is what do you mean by "defined" ?

I was looking for something like the preprocessor's defined. I want to
check wether a variable is defined or not. The actual value of the
variable is not important but I'd like an empty value to be treated as
defined.

Here's what I've learned so far:

- An undefined variable has the same logical value (false) as a
variable with an empty value.
- The ?= operator distinguishes the two, a variable with an empty
value is not redefined with it.

Right now I'm using ?= to redefine the undefined variables to a "magic"
value. Later on the magic value is tested for explicitly. The downside
is that I can't use the defined(variable) syntax with the preprocessor
anymore.

Are there other ways to distinguish empty values from undefined ones?

Best regards,

João Abecasis

 


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