From 546895a93a29062bb178367b46c7afb72da9881e Mon Sep 17 00:00:00 2001 From: ReenigneArcher <2669457-ReenigneArcher@users.noreply.gitlab.com> Date: Sat, 13 Sep 2025 11:32:38 -0400 Subject: [PATCH] build(cmake): fix for boost 1.89 --- CMakeLists.txt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 78c94e5..8c16916 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,8 +41,20 @@ if(USE_STANDALONE_ASIO) target_include_directories(simple-web-server SYSTEM INTERFACE ${ASIO_PATH}) endif() else() - find_package(Boost 1.53.0 COMPONENTS system REQUIRED) - target_link_libraries(simple-web-server INTERFACE Boost::boost Boost::system) + # In Boost 1.89.0+, system is header-only, so we try to find it but make it optional + find_package(Boost 1.53.0 COMPONENTS system) + if(NOT Boost_FOUND) + # Fallback: try without system component for newer Boost versions where it's header-only + find_package(Boost 1.53.0 REQUIRED) + endif() + + target_link_libraries(simple-web-server INTERFACE Boost::boost) + + # Only link Boost::system if the target exists (for older Boost < 1.89) + if(TARGET Boost::system) + target_link_libraries(simple-web-server INTERFACE Boost::system) + endif() + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) target_compile_definitions(simple-web-server INTERFACE USE_BOOST_REGEX) find_package(Boost 1.53.0 COMPONENTS regex REQUIRED)