diff --git a/cmake/dependencies/Boost_Sunshine.cmake b/cmake/dependencies/Boost_Sunshine.cmake index 11e7770a..eddc4ebd 100644 --- a/cmake/dependencies/Boost_Sunshine.cmake +++ b/cmake/dependencies/Boost_Sunshine.cmake @@ -9,9 +9,8 @@ set(BOOST_COMPONENTS locale log program_options - system ) -# system is not used by Sunshine, but by Simple-Web-Server, added here for convenience +# boost_system is header-only since Boost 1.69 and has no compiled library since 1.89+ # algorithm, preprocessor, scope, and uuid are not used by Sunshine, but by libdisplaydevice, added here for convenience if(WIN32) @@ -101,3 +100,12 @@ endif() message(STATUS "Boost include dirs: ${Boost_INCLUDE_DIRS}") message(STATUS "Boost libraries: ${Boost_LIBRARIES}") + +# boost_system is header-only since Boost 1.69 and has no compiled library in 1.89+. +# Create a stub INTERFACE target for backward compatibility (e.g., Simple-Web-Server). +if(NOT TARGET Boost::system) + add_library(Boost::system IMPORTED INTERFACE GLOBAL) + if(TARGET Boost::headers) + target_link_libraries(Boost::system INTERFACE Boost::headers) + endif() +endif() diff --git a/cmake/macros/common.cmake b/cmake/macros/common.cmake index 53a3c694..a5f2d81e 100644 --- a/cmake/macros/common.cmake +++ b/cmake/macros/common.cmake @@ -22,6 +22,12 @@ macro(find_package) # cmake-lint: disable=C0103 (("${ARGV0_LOWER}" STREQUAL "libevdev") AND DEFINED EXTERNAL_PROJECT_LIBEVDEV_USED) ) # Do nothing, as the package has already been fetched + elseif("${ARGV0_LOWER}" STREQUAL "boost_system" AND Boost_FOUND) + # boost_system is header-only since Boost 1.69 with no compiled library in 1.89+. + # BoostConfig.cmake calls find_package(boost_system) internally; intercept it here + # and report success so BoostConfig.cmake accepts Boost::system as a valid target. + set(boost_system_FOUND TRUE) # cmake-lint: disable=C0103 + set(boost_system_VERSION "${Boost_VERSION}") # cmake-lint: disable=C0103 else() # Call the original find_package function _find_package(${ARGV})