Boost logo

Boost :

From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2007-11-26 07:35:46


Hi Darren!

On Nov 26, 2007 3:33 AM, Darren Garvey <darren.garvey_at_[hidden]> wrote:
>
> On 26/11/2007, Dean Michael Berris <mikhailberis_at_[hidden]> wrote:
> >
> > Hi Everyone,
> >
> > I've recently tried the suggestion in the Boost.Build documentation
> > regarding the use of the lib rule to name libraries that can be
> > supplied as dependencies and having the library available in the
> > search path. I have a Jamfile that looks like:
> >
> > project my_project :
> > requirements <include>..
> > <link>static
> > ;
> >
> > lib some_system_installed_lib : : <name>mylib ;
>
>
> I'm not sure what you expect this to do. This lib has no sources and IIUC no
> actual target. You can use the <location>/path/to/your/lib 'bit' (not sure
> if this is called a feature, property, or what). I think that's what you're
> expecting the <name> property? to do.
>

Actually, I've gotten around it by doing the following (taking an
example for example to use system installed MySQL client libraries):

lib mysqlclient : :
  <link>static:<file>/usr/local/mysql/lib/libmysqlclient.a
  <link>shared:<name>mysqlcient
  ;

lib z : : # Required by mysqlclient
  <link>static:<file>/usr/lib/libz.a
  <link>shared:<name>z
  ;

alias mysql : mysqlclient z ;

> Just as a tip; something I noticed the other day from looking at the
> sandbox math toolkit. If you want to link to a Boost.Build target, such as a
> boost library (eg. Boost.Thread), you can use:
>
> use-project /boost/thread/ : $(boost-root)/libs/thread/build ;
>
> exe my_exe
> :
> my_main.cpp
> :
> <library>/boost/thread/
> ;
>
> And AFAICT this will mean my_exe uses the right Boost.Thread object file for
> the exe's requirements, building it if necessary. It'll also inherit all the
> requirements of that project. I thought this was very cool. I get the
> impression that this isn't common knowledge. :(
>

Well, it should be common knowledge. I've been putting the following
code to pull in the Boost root dir into the top level Jamfile (or
Jamroot) of some of my projects:

import modules ;

# Look for BOOST_ROOT environment variable
local BOOST_ROOT : [ modules.peek : BOOST_ROOT ] ;

use-project /boost : $(BOOST_ROOT) ;

exe my_exe : main.cpp /boost//thread /boost//regex ;

> Hope that helps,

Definitely does. :) Thanks for taking the time to share the tip!

-- 
Dean Michael C. Berris
Software Engineer, Friendster, Inc.
[http://cplusplus-soup.blogspot.com/]
[mikhailberis_at_[hidden]]
[+63 928 7291459]
[+1 408 4049523]

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk