Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2002-07-11 10:12:27


Markus Schöpflin wrote:
> Hello,
>
> what's the officially supported way of linking a boost library
> with an external project that uses boost::build?
>
> Say I have my own project foo that wants to link to the boost
> thread library. I have set up everything so that I can compile
> the project but I can't see how to link to the thread lib.
>
> For example:
>
> exe foo : foo.cpp : <sysinclude>$(BOOST_ROOT) ;
>
> I tried to add
> <find-library>$(BOOST_ROOT)/libs/thread/build/boost_thread
> hoping that bjam would find the right thread lib on it's own
> but that doesn't work as it just adds -l<...>/build/boost_thread
> to the linker command line not taking into account the variants.

Yes... that's what it does. To link with a library you'd need to use
<library-file>feature. Here's an example:

exe a : a.cpp : <library-file>b.a ;

The problem, is that you have to specify *exact* name to the library. That
is, you can't use different variants (debug/release) of it.

> Next I tried to add
> <lib>$(BOOST_ROOT)/libs/thread/build/boost_thread to the
> sources but this doesn't work either because bjam doesn't
> find threads.jam which is included from the Jamfile in the
> thread build directory.

I'm afraid that never worked. In fact, smooth project interaction is one of
my personal motivations for V2 and the good news is that using targets across
different projects already works there :-)

- 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