Skip to content

Commit bc7ea1f

Browse files
authored
fix(boost): do not link to ALIAS target (#128)
1 parent bbcd179 commit bc7ea1f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

cmake/Boost_DD.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@ else()
3030
# (differ in linked targets).
3131
# Also, FetchContent creates Boost::<lib> targets, whereas find_package does not. Since we cannot extend
3232
# Boost::headers as it is an ALIAS target, this is the workaround:
33+
get_target_property(ORIGINAL_TARGET Boost::headers ALIASED_TARGET)
34+
if (ORIGINAL_TARGET STREQUAL "ORIGINAL_TARGET-NOTFOUND")
35+
set(ORIGINAL_TARGET Boost::headers)
36+
endif ()
3337
foreach (lib ${REQUIRED_HEADER_LIBRARIES})
3438
if (NOT TARGET Boost::${lib})
35-
add_library(Boost::${lib} ALIAS Boost::headers)
39+
add_library(Boost::${lib} ALIAS ${ORIGINAL_TARGET})
3640
endif ()
3741
endforeach ()
3842
endif()

0 commit comments

Comments
 (0)