Boost logo

Boost-Build :

Subject: Re: [Boost-build] Handling libraries that are built with external build systems
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2016-06-07 10:46:11


AMDG

On 06/07/2016 07:06 AM, Christian Aichinger wrote:
> In a project that uses Boost Build, is there an easy way to have library sub-projects that use other build systems (e.g. CMake)? The resulting .a/.so files should be used by bjam.
>
> E.g.
> ./Jamroot
> ./ext/external-lib/ # built using cmake
> ./lib/internal-lib/ # internal library using bjam
> ./src/ # application code, using both libs
> ...
>
> I tried creating ext/external-lib/Jamfile with the following code:
>
> notfile build_extlib : @build_extlib ;
> actions build_extlib
> {
> # ... build instructions ...
> touch libextlib.a
> }
>
> lib extlib : :
> <file>libextlib.a
> : :
> <include>include
> ;
>
> I can then run `bjam ext/external-lib//build_extlib` and use `ext/external-lib//extlib` as library in other targets. However, the build process does not happen automatically. Adding build_extlib as dependency to extlib didn't work, bjam complained about the missing libextlib.a (the build product of build_extlib). I tried using implicit-dependency, but that didn't work either (build_extlib was never executed).
>
> What's the best solution to this problem? Converting extlib to Bjam is not an option, it's a rather involved build system.
>

Try using make instead of notfile. (warning untested)

make libextlib.a : : @build_extlib ;
alias extlib : libextlib.a ;

(Boost.Build should deduce that it's
a static library from the .a extension.)

In Christ,
Steven Watanabe


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