FindBoost: In boost-cmake mode the legacy Boost_LIBRARIES variable contains target names
Since !3438 (merged) when emulating the legacy FindBoost variables in the new boost-cmake mode, the variable
Boost_LIBRARIES (and the single-component
Boost_X_LIBRARY variables) contain the target names (
As I understand, these variables always contained absolute paths to the library files.
For simple use cases (
target_link_libraries) this should not matter, but this change breaks backwards compatibility in the following real-world usecase:
A separate library X uses CMake for its build system and depends on Boost::regex by using the legacy variables. The library package exports the main library target for the consumers, so the values of these variables are exported in the interface properties of the imported target in
x-config.cmake. Before these changes CMake consumers of X library worked properly, without knowing about Boost.Regex.
Now if the consumer does not depend on Boost.Regex the build fails:
boost::regex target does not exist in any way in the consumer context.
Could absolute library paths be used instead of target names in the legacy variables to preserve backwards compatibility? As I understand, the plan in #19402 was to provide them mainly to avoid breaking existing build systems in an unmanaged way.