Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2022-06-04 10:57:33


Dennis Luehring wrote:
...
> the clang-cl build got a link error:
> lld-link: error: could not open
> 'libboost_unit_test_framework-clangw14-mt-gd-x64-1_79.lib': no such file
> or directory
> even when boost is built with -layout=tagged

This error is caused by autolinking.

The CMake config files used to define BOOST_ALL_NO_LIB, which disabled
autolinking entirely, but this caused complaints (as autolinking is useful
when it works correctly), so we changed the config files to only define
the appropriate BOOST_<LIBNAME>_NO_LIB macro.

This fails in the specific case of Boost.Test because there the macro name
used presently to disable autolink is BOOST_TEST_NO_LIB, but the CMake
config for Boost::unit_test_framework defines
BOOST_UNIT_TEST_FRAMEWORK_NO_LIB (as it derives the macro by
uppercasing the library name.)

We've changed Boost.Test to recognize the _DYN_LINK macros
corresponding to the library name:

https://github.com/boostorg/test/commit/625bafd2cdc3e9a6f338573a17558050e2bd0e58

but didn't think at the time to do the same for the _NO_LIB ones (as it was
unnecessary then).

We should fix this in Boost.Test. In the meantime, you can disable
autolinking by defining BOOST_ALL_NO_LIB, which can be done e.g. by
changing

> target_link_libraries(example Boost::unit_test_framework)

to

target_link_libraries(example Boost::unit_test_framework Boost::disable_autolinking)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk