Subject: Re: [boost] Use of third-party libraries
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2014-07-23 07:31:08
On Wed, Jul 23, 2014 at 3:14 PM, Michael Shepanski <mps_at_[hidden]> wrote:
> On one hand, there's this:
> "A Boost library *should not* use libraries other than Boost or the C++
> Standard Library."
> On the other hand, sometimes it just seems like common sense. E.g.
> Boost.Math uses NTL, MPFR, and others.
> Now I'm trying to get quince and its backend libraries (quince_postgresql,
> quince_sqlite) into shape for blincubator. The job of the backends is to
> liaise between quince and other people's libraries: libpq and sqlite3. There
> is no getting around that. So I was hoping that the prohibition would be
> waived in this case, as it was in the case of Boost.Math.
> The trouble I have is that quince_postgresql and quince_sqlite are *not*
> header-only, and their code that calls libpq and sqlite3 is in .cpp files.
> And yet I don't want them to break the boost build for people who don't need
> this stuff, and haven't installed either or both of those third-party
> Any suggestions? Any precedents?
The library build scripts should perform auto-detection checks at
build time. I have something like this in Boost.Log, although I test
whether the compiler supports SSE/AVX and whether Message Compiler is
available. But the approach should be similar - you attempt to compile
a test application and set up build macros or select the actual
sources to build from.
You can also take a look at Boost.IOStreams which detect if bzip2 and
zlib are available. Boost.Thread also contains some auto-detection
checks, I think.