Skip to content

Commit 23ac40a

Browse files
committed
Do not use imported targets for Boost because they're continually broken. Part 2.
1 parent d065815 commit 23ac40a

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

Release/cmake/cpprest_find_boost.cmake

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,24 @@ function(cpprest_find_boost)
2727
# FindBoost continually breaks imported targets whenever boost updates.
2828
if(1)
2929
target_include_directories(cpprestsdk_boost_internal INTERFACE "$<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>")
30-
target_link_libraries(cpprestsdk_boost_internal INTERFACE "$<BUILD_INTERFACE:${Boost_LIBRARIES}>")
30+
set(_prev)
31+
set(_libs)
32+
foreach(_lib ${Boost_LIBRARIES})
33+
if(_lib STREQUAL "optimized" OR _lib STREQUAL "debug")
34+
else()
35+
if(_prev STREQUAL "optimized")
36+
list(APPEND _libs "$<$<NOT:$<CONFIG:Debug>>:${_lib}>")
37+
elseif(_prev STREQUAL "debug")
38+
list(APPEND _libs "$<$<CONFIG:Debug>:${_lib}>")
39+
else()
40+
list(APPEND _libs "${_lib}")
41+
endif()
42+
endif()
43+
set(_prev "${_lib}")
44+
endforeach()
45+
message(STATUS "_libs: ${_libs}")
46+
target_link_libraries(cpprestsdk_boost_internal INTERFACE "$<BUILD_INTERFACE:${_libs}>")
47+
3148
else()
3249
if(ANDROID)
3350
target_link_libraries(cpprestsdk_boost_internal INTERFACE

0 commit comments

Comments
 (0)