|
Boost Users : |
Subject: Re: [Boost-users] how to link libraries in Jamroot?
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2009-07-13 11:55:27
Arne Kalaghan wrote:
>
> Hello,
> I am not very experienced with boost. I try to learn how to use the boost.thread library. After
> early bjam compilation errors (undefined references, because the boost_thread library was not
> linked), I found that this Jamroot creates my executable successfully:
>
> exe threadtest : threadtest.cpp
> : <library>/usr/lib/libboost_thread-gcc42-mt-1_34_1.so.1.34.1
> ;
>
> Is it possible to simplify the <library> parameter to something like "boost_thread"? The reason is
> that I am developing on different systems with different boost versions, so that I don't want to
> hardcode the library version in the Jamroot. I thought that the boost.build system should be smart
> enough that it finds the appropriate library file if you only tell it "use the thread library
> please".
>
> How can I make the Jamroot independent from the boost installation and, more importantly, from the
> operation system?
It depends on whether you plan to have Boost source tree available around, or not. If yes, then
you can have:
use-project /boost : <path-to-boost> ;
and then:
<library>/boost//boost_thread
whenever you need it. If you want to link against system-wide Boost, you probably should be
using
searched-lib boost_thread ;
and then use 'boost_thread' somewhere. Unfortunately, many Linux distros ship binaries with
full decoration, it's a bit hard to deal with. See contrib/boost.jam for one possible
solution.
- Volodya
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net