Boost logo

Boost :

Subject: Re: [boost] Installing CMake configuration files
From: Louis Dionne (ldionne.cpp_at_[hidden])
Date: 2018-10-16 02:26:08

On Fri, Oct 12, 2018 at 8:01 PM Peter Dimov via Boost <boost_at_[hidden]>

> I've taken another stab at installing CMake configuration files along with
> the libraries in `b2 install`. CMake configuration files are .cmake files,
> typically installed into $prefix/lib or $prefix/lib/cmake, that allow
> f.ex.
> `find_package(boost_system)` in a CMakeLists.txt file to find the
> installed
> Boost.System library and declare a CMake target Boost::system that refers
> to
> it. CMake targets can then link to Boost::system and all is well.


> [...]

> The header-only libraries are used from CMake by finding the package
> boost_headers and linking to the target Boost::headers. I've deliberately
> not done anything about Boost::boost and find_package(Boost), to allow
> FindBoost.cmake to delegate to the config files if present (when Boost
> 1.69/1.70 or higher is installed), while preserving backward compatibility
> (when 1.68 or lower is installed.)

Would it be possible to have one Boost::XYZ library for each header-only
library XYZ? Those would just include the headers by default, however it
has the following benefits from the user side:
1. If a library stops being header-only, user code still works and will
automatically start linking against the right library when the CMake Config
file is updated.
2. It allows providing compile options or required compile features via the
imported target. For example, I may want someone "linking" against
Boost::hana to get `-Wno-user-defined-literal` automatically (I don't, but
you get the idea).


Boost list run by bdawes at, gregod at, cpdaniel at, john at