From: Peter Dimov (pdimov_at_[hidden])
Date: 2020-09-15 17:31:13


Although, now that I think of it, the shown CMakeLists.txt file didn't use
imported targets, so perhaps the order of libraries is literal and putting
log_setup before log may indeed solve things.

-----Original Message-----
From: Peter Dimov
Sent: Tuesday, September 15, 2020 20:28
To: boost_at_[hidden]
Subject: Re: [boost] Boost Log 1.65.1 Linking Issue

Andrey Semashev wrote:

> I'm not sure, but I think the above would generate incorrect order of
> libraries in the linker command line. You need to ensure that boost_log
> comes after boost_log_setup, and their dependencies come after still.

CMake automatically orders libraries so that the dependencies come after.
Unfortunately, FindBoost has a bug and declares log as depending on
log_setup, rather than vice versa.

https://github.com/Kitware/CMake/blob/bdcde7762c71cd27fcba6dc1a3efe12fa7a09fef/Modules/FindBoost.cmake#L1177

No matter how you order the libraries in target_link_libraries, the order
between these two will never be correct.

Not sure if this is the problem here though.