Skip to content

Commit

Permalink
build(CMakeLists.txt): inject BOOST_UUID_FORCE_AUTOLINK to fix bcrypt…
Browse files Browse the repository at this point in the history
… link error with mingw64
  • Loading branch information
WhiredPlanck committed Oct 4, 2023
1 parent e8fd6c9 commit 9cec845
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,25 @@ else()
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} signals)
endif()

add_definitions(-DBOOST_DLL_USE_STD_FS)
if(WIN32)
add_definitions(-DBOOST_UUID_FORCE_AUTO_LINK)
endif()

find_package(Boost 1.74.0 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
if(Boost_FOUND)
add_library(Boost INTERFACE)
target_link_libraries(Boost INTERFACE "${BOOST_TARGETS}")
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
# Boost.Uuid needs and therefore auto-links bcrypt by default on Windows since 1.67.0
# but provides this definition to force that behaviour because if find_package(Boost)
# found BoostConfig.cmake, the Boost:: targets all define BOOST_ALL_NO_LIB
target_compile_definitions(
Boost INTERFACE
BOOST_UUID_FORCE_AUTO_LINK
)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
add_definitions(-DBOOST_DLL_USE_STD_FS)
endif()

if(ENABLE_LOGGING)
Expand Down

0 comments on commit 9cec845

Please # to comment.