Boost logo

Boost-Build :

Subject: Re: [Boost-build] Copying an external library with the install rule
From: Vladimir Prus (ghost_at_[hidden])
Date: 2010-11-06 11:54:17


On Monday, October 25, 2010 00:52:05 Oliver Koenig wrote:
> Hello,
> we need to link to a (platform-dependant) external library like this:
>
> lib ext_lib
>
> : : <name>ext <search>$(EXT_PKG_LIB_DIR)
> : : <include>$(EXT_PKG_INC_DIR)/ext ;
>
> lib my_lib : my_source.cpp ext_lib ;
>
> Nothing special so far, and this works fine. In a next step we would
> like to install all libs with all dependencies to a single directory in
> order to make it easy to build and run a (Boost-) Python application
> which uses these libraries:
>
> install install_libs
>
> : my_lib
> : <location>$(ROOT)/lib <install-dependencies>on <install-type>LIB ;
>
> The install rule does not install pre-built libraries, hence the lib
> ext.dll is missing in $(ROOT)/lib. We tried then to copy this library
> with a separate install rule:
>
> install install_ext_lib : $(EXT_PKG_LIB_DIR)/ext.dll
>
> : <toolset>msvc <location>$(ROOT)/lib ;
>
> install install_libs
>
> : my_lib install_ext_lib
> : <location>$(ROOT)/lib <install-dependencies>on <install-type>LIB ;
>
> Trying to run this produces the following error:
>
> error: Duplicate name of actual target: <p...>ext.dll
> error: previous virtual target ( common%common.copy-ext.dll.SHARED_LIB ...
>
> Any hints how to solve this 'dilemma'? Maybe there is a hidden option in
> the install rule which copies ALL libs?

There is no such option, because in general, for searched lib, Boost.Build
does not know where it is.

The reason you get duplicate name error is that your first 'install' metatarget
installs the
library in $(ROOT)/lib, and then your second install metatarget tries to take
that installed target, and install it again to the same location.
If you replace first declaration with:

        alias install_ext_lib : $(EXT_PKG_LIB_DIR)/ext.dll ;

things should work better.

- Volodya

-- 
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build: http://boost.org/boost-build2

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