diff --git a/cmake/Boost_DD.cmake b/cmake/Boost_DD.cmake index 07ac57e..835221b 100644 --- a/cmake/Boost_DD.cmake +++ b/cmake/Boost_DD.cmake @@ -30,9 +30,13 @@ else() # (differ in linked targets). # Also, FetchContent creates Boost:: targets, whereas find_package does not. Since we cannot extend # Boost::headers as it is an ALIAS target, this is the workaround: + get_target_property(ORIGINAL_TARGET Boost::headers ALIASED_TARGET) + if (ORIGINAL_TARGET STREQUAL "ORIGINAL_TARGET-NOTFOUND") + set(ORIGINAL_TARGET Boost::headers) + endif () foreach (lib ${REQUIRED_HEADER_LIBRARIES}) if (NOT TARGET Boost::${lib}) - add_library(Boost::${lib} ALIAS Boost::headers) + add_library(Boost::${lib} ALIAS ${ORIGINAL_TARGET}) endif () endforeach () endif()