Boost logo

Boost-Build :

From: Jonathan Biggar (jon_at_[hidden])
Date: 2008-07-24 00:10:07


Jonathan Biggar wrote:
>> My suggestion is to define a new composite, non-incidental feature.
>>
>> However this is not supported for 'free' features that take 'any
>> text' as their value (because Boost Build currently encodes used
>> properties that affect the build as path to the built target and free
>> feature values would mess up that path). You would need to define a
>> list of possible tag values and then convert them to exact paths
>> inside your build script.
>
> The last part is a problem, since the idea is to allow the user to build
> the library and install it wherever he likes, which isn't compatible
> with a preset list of feature values.
>
> But I wonder if it's possible to declare the feature and then use
> feature.extend to add the value I need on the fly (derived by converting
> '/' to '-' from the user provided install path). Or even simpler, just
> calculate the right value up front before declaring the feature.
>
> I'll have to experiment and see if I can make that work.

Yup, that worked like a charm. I did something like this:

install-path = /foo/bar ;

embedded-path =
     [ string.join [ string.words $(install-path) : / ] : % ] ;

feature.feature embedded-paths : no-paths $(embedded-path) : implicit;

lib foo
     : $(SOURCES)
     : <embedded-path>$(embedded-path) <define>MYPATH=$(install-path)
     ;

package.install
     :
     : foo
     :
     : <install-default-prefix>$(install-path)
     ;

and foo%bar shows up in my build directory path, which ensures that the
library gets installed with the same embedded path it was built with.

-- 
Jon Biggar
Floorboard Software
jon_at_[hidden]
jon_at_[hidden]

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