Rainer Deyke wrote:
On 10.06.21 23:36, Andrey Semashev via Boost wrote:
CMake defines targets for header-only libraries, which can have dependencies on other targets, including on static or shared libraries. So the program that "links" to the header-only library picks up its dependencies recursively. As a result, the linker is invoked with all (binary) libraries in the dependency tree.
If this functionality works the way I think does, then I think it should not be used.
Not "linking" to header-only libraries properly only works when all the headers are dumped into a central location, e.g. /usr/include or, in our case, $BOOST_ROOT/boost. That it works with our b2 setup is an artifact of this physical organization (and requires our `b2 headers` step). If the libraries are properly separated, which should really be required by any sane package management scheme, you have to "link" to header-only libraries in order to get the proper directory into your include path. As a side effect, this also makes the compiled -> header-only -> compiled case work without any effort from the end user (who would otherwise be forced to change his link line if an update to 'header-only' changes the list of compiled libraries that need to be linked).