Boost logo

Boost-Build :

Subject: [Boost-build] Static library using shared one
From: Paul Graphov (graphov_at_[hidden])
Date: 2013-03-06 04:26:20


Hello boost-build,

I was unable to find an answer in the documentation so I decided to ask here.
I'm working on a project that uses boost-build. Build process has two
results: main binary file and regression test that is run
automatically by boost-build. Both share a lot of common object files.
To avoid copy-paste in Jamroot and complaints about targets with the
same name I separated that common files into a static library (let it
be my_lib). The problem is that some code in that library depends on
boost.system which I want to be shared (unless I use link=static at
command line). If I just mention my_lib and /boost//system in sources
of both binaries they may be passed to the linker in wrong order. But
if I also mention /boost//system in either sources or via <use> in
requirements for my_lib, it seems to try compiling it both static and
shared and fails with error:

/home/druid/work/boost_1_53_0/boost/system/config.hpp:33:3: error:
#error Must not define both BOOST_SYSTEM_DYN_LINK and
BOOST_SYSTEM_STATIC_LINK
(this happens if some of my modules include any boost header)

This is my minimal jamroot.jam file:
http://pastebin.com/Fcj04Z7i

Am I doing it wrong? Is there a way to workaround this?
Thanks!


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