Boost logo

Boost-Build :

Subject: Re: [Boost-build] Conditional compilation and lib dependency
From: Vladimir Prus (ghost_at_[hidden])
Date: 2009-04-08 01:43:27


On Wednesday 08 April 2009 04:49:56 John Bito wrote:
> I'm trying to sort out how to compile a sub-project in two different ways
> (the conditional code is controlled by -DJAVA). I'll make two different
> libaries (foo & foo_java). The question is how to let the boost-build know
> that there are distinct sets of objects even though the sources are
> identical.
>
> lib foo : s1.c s2.c ;
>
> lib foo_java : s1.c s2.c : <define>JAVA ;
>
> The above is what I'm inclined to utter, but I get complaints about
> Duplicate name of actual target: <pbin/sun/debug/link-static>s1.o

You obviously need to put those object files into different directories.
One approach is this:

        import feature ;
        feature.feature java : off on : composite ;
    feature.composite <java>on : <define>JAVA ;

    lib foo : s1.c s2.c ;
    lib foo_java : s1.c s2.c : <java>on ;

The only difference from your original example is that <java> is a feature with
specific set of values, so Boost.Build knows how to generate different paths
for objects with different values of this feature, while <define> is a low-level
feature and it will be impractical to represent every <define> in target path.

HTH,
Volodya


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