Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-10-08 00:08:17


> It feels like this should be easy, but I can't quite make it work. I
> have some set of source associated with feature-X that I would like
> compiled when the user defines USE_FEATURE_X. From what I can tell,
> this will define that variable:
> bjam define=USE_FEATURE_X
>
> However, I can't figure out how to use that to "enable" the optional
> sources. It seems that using two aliases should do the trick, but I
> can't figure out the syntax. For instance:
>
> alias feature-x-sources ;
> alias feature-x-sources : a.cc b.cc : if-defined(USE_FEATURE_X) ;
> exe extreme-pong : main.cc feature-x-sources ;
>
> It's the "if-defined" part I can't figure out.

You should use something line <X>on in requirement for the second
"feature-x-sources" alternative. Before that, you'll have to declare the "X"
feature, too. I attach an example which does it. When I run

bjam

only one file is compiled, and when I run

bjam X=on

another one is compiled as well. Is that OK?

- Volodya

 --Boundary-00=_Bv5g/I9PMXG7Ei0 Content-Type: application/x-zip;
name="conditionals.zip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="conditionals.zip"

[Attachment content not displayed.] --Boundary-00=_Bv5g/I9PMXG7Ei0--


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