From 749a721aa28ed0aa3aba85ff014324ba824cdc8c Mon Sep 17 00:00:00 2001 From: Castor215 <132155746+Castor215@users.noreply.github.com> Date: Sat, 17 Feb 2024 14:39:38 +0000 Subject: [PATCH] externals: disable system cpp-httplib if it is a shared object (#7446) Co-authored-by: Castor216 --- externals/CMakeLists.txt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 5f4c23ad3..fc45473b6 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -294,11 +294,20 @@ endif() add_library(httplib INTERFACE) if(USE_SYSTEM_CPP_HTTPLIB) find_package(CppHttp 0.14.1) - if(CppHttp_FOUND) - target_link_libraries(httplib INTERFACE httplib::httplib) - else() - message(STATUS "Cpp-httplib not found or not suitable version! Falling back to bundled...") + # Detect if system cpphttplib is a shared library + # this breaks building as Citra relies on functions that are moved + # into the shared object. + get_target_property(HTTP_LIBS httplib::httplib INTERFACE_LINK_LIBRARIES) + if(HTTP_LIBS) + message(WARNING "Shared cpp-http (${HTTP_LIBS}) not supported. Falling back to bundled...") target_include_directories(httplib SYSTEM INTERFACE ./httplib) + else() + if(CppHttp_FOUND) + target_link_libraries(httplib INTERFACE httplib::httplib) + else() + message(STATUS "Cpp-httplib not found or not suitable version! Falling back to bundled...") + target_include_directories(httplib SYSTEM INTERFACE ./httplib) + endif() endif() else() target_include_directories(httplib SYSTEM INTERFACE ./httplib)