Boost logo

Boost-Build :

From: Phillip Seaver (phil_at_[hidden])
Date: 2007-08-29 09:28:47


Roland Schwarz wrote:
> Say I have a lib targets:
>
> lib program_options : $(sources) :
> <define>PROGRAM_OPTIONS_DYN_LINK:<link>shared ;
>
> lib coollib : $(cool_srces) : <define>COOL_DYN_LINK:<link>shared ;
>
> and an exe target:
>
> exe myapp : mysrc.cpp program_options coollib :
> <define>PROGRAM_OPTIONS_DYN_LINK ;
>
> The idea is to control which library is been linked static, and which is
> to be linked as shared lib.
>
> However, although Boost.Build does not complain, the conditional doesn't
> seem to evaluate.
>
> Any hints welcome!
>
> Btw.: What is the recommended way to specify mixed link type at all?
> I.e.
> exe myapp : src.cpp lib1 lib2 ;
> How do I specify lib1 is to link statically while lib2 shared?
>
> Roland aka speedsnail
You should be able to do "exe myapp : src.cpp lib1/<link>static
lib2/<link>shared ;", I believe -- I haven't been able to find where I
did that before.

If you want it controlled by a feature, I think you'll have to make your
own, since <define> isn't one of the features that differentiate between
builds. Something like this _might_ work:

    feature program_options_link : shared static ;

    lib program_options : $(sources) :
    <program_options_link>shared:<link>shared
    <program_options_link>static:<link>static ;

    exe myapp : mysrc.cpp program_options coollib :
    <program_options_link>shared ;

Phillip


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