Boost logo

Boost-Build :

Subject: Re: [Boost-build] Is it possible to set a features default value with an indirect conditional target ?
From: Aaron Boman (aaron_at_[hidden])
Date: 2016-06-18 10:39:29


> rule set_default_abi ( )

> {

> local abi =<conditional>@default_abi ;

> return $(abi) ;

> }

That's not how <conditional> properties work. You must specify the
conditional
property on a target. When the target is considered for building, then
the function
name as the value on the <conditional> will be called with the
properties to build
for that target. The callback function is then supposed to return any
*additional*
properties to add to the property set.

You almost had default_abi set up correctly. The only thing you need to
change
is the return statement from `return $(tmp) ;` to `return <abi>$(tmp) ;`

Then, you must specify `<conditional>@default_abi` on a *target's*
requirements.

```
exe kernel : kernel_main.c : <conditional>@default_abi ;
```

This won't actually set a default value for the <abi> feature, but it
should correctly set
the <abi> value for the target given.

So, to answer your original question, no, it is not possible to set the
default value
of a feature with an indirect conditional target as $(properties) is not
available
until the virtual target generation phase has begun.

Aaron


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