Boost logo

Boost-Build :

From: Jurko Gospodnetić (jurko.gospodnetic_at_[hidden])
Date: 2008-08-23 18:17:34

   Hi William.

> I tried to create rule that build a dll and install it at the same time but
> it doesn't seem to work and i don't know why :
> rule kdll ( name )
> {
> lib $(name) : [ glob *.cpp ] : <link>shared ;
> install dist$(name) : $(name) : <location> c:/temp :
> <install-type>SHARED_LIB ;
> }
> this works perfectly when i build the library, but if i try to build an exe
> that uses that library, it builds the library but doesn't install it.
> Is it normal ?, if yes how can i do that ?

   My guess is that your exe target is defined in a separate Jamfile
which then calls the use-project rule in order to get access to the
Jamfile defining this library target.

   If that is so then everything 'seems to work' perfectly when you
build your library project and only when you build that whole project.
This is because both your $(name) & dist$(name) targets have been
defined as 'implicit' targets and get built automatically when building
their project.

   If you make your dist$(name) target explicit (by calling 'explicit
dist$(name) ;' after defining it) then building the library project will
no longer automatically install the library and you will need to list
the dist$(name) target explicitly in order to build it.

   And now to get back to your original problem...

   I think the cleanest currently available way to solve your issue is
to make your exe have a build and an install target and then have its
install target list the library's install target as its source. You then
build the install target in order to get a working executable ready for

   An alternative that would get you what you want right now, but which
I believe might actually be due to a bug, is to list the the dist$(name)
target as a source for your exe. The bug I refer to is that Boost Build
seems to silently ignore any sources that it can not consume when
running a composing generator and here is can not consume the folder
created by install nor the installed dll but only the import library
(assuming you're using a shared library).

   Perhaps someone will correct me, but I do not believe there is
currently a clean way to say 'when target A gets built then
automatically build target B as well' when target B depends on A, at
least not without modifying Boost Build. There is the dependency feature
that does this and more but only when B does not depend on A (otherwise
it would construct a circular dependency).

   Hope this helps.

   Best regards,
     Jurko Gospodnetić

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