Boost logo

Boost-Build :

Subject: Re: [Boost-build] executables and library dependencies
From: Gevorg Voskanyan (v_gevorg_at_[hidden])
Date: 2010-04-15 14:10:34

Jim Gallagher wrote:
> If I'm building an executable that uses lib b, and lib b depends on lib a,
> must I list both lib a and lib b as sources for the exe? The sample in the
> docs seems to indicate
> "yes":
> <>

> I would prefer not to, but I suspect it is this way for a
> reason.

Hi Jim,

When lib 'a' <use> lib 'b', it does not cause library 'a' to link with library 'b', it only makes 'b' a dependency for 'a' and integrates 'b' library's usage requirements into build properties of 'a'. Listing a library in another's sources, or using the <library> feature, is another matter though. So if we have

lib b : b.cpp ;
lib a : a.cpp b ; # or, lib a : a.cpp : <library>b ;
exe e : a ; # no need to list 'b' in sources of 'e'

It should just work so that 'e' will be properly linked to 'b'.

This has been my experience at least, please come back if yours happens to be different :-)


Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at