From 7931aac3b72d08edad9b164dded06ed7bea56aac Mon Sep 17 00:00:00 2001 From: Castor215 <132155746+Castor215@users.noreply.github.com> Date: Fri, 6 Oct 2023 00:41:07 +0100 Subject: [PATCH] externals: require cpp-httplib >= 0.14.1 (#7043) --- externals/CMakeLists.txt | 9 +++++++-- externals/cmake-modules/FindCppHttp.cmake | 10 ++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 5a2548bca..9f50bbc73 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -209,8 +209,13 @@ endif() # httplib add_library(httplib INTERFACE) if(USE_SYSTEM_CPP_HTTPLIB) - find_package(CppHttp REQUIRED) - target_link_libraries(httplib INTERFACE cpp-httplib::cpp-httplib) + find_package(CppHttp 0.14.1) + if(CppHttp_FOUND) + target_link_libraries(httplib INTERFACE cpp-httplib::cpp-httplib) + else() + message(STATUS "Cpp-httplib not found or not suitable version! Falling back to bundled...") + target_include_directories(httplib INTERFACE ./httplib) + endif() else() target_include_directories(httplib INTERFACE ./httplib) endif() diff --git a/externals/cmake-modules/FindCppHttp.cmake b/externals/cmake-modules/FindCppHttp.cmake index b91cc9f6e..fe17c8bab 100644 --- a/externals/cmake-modules/FindCppHttp.cmake +++ b/externals/cmake-modules/FindCppHttp.cmake @@ -14,14 +14,8 @@ if(NOT CppHttp_FOUND) /usr/lib /usr/local/lib ) - - if(CPP-HTTP_INCLUDE_DIR AND CPP-HTTP_LIBRARIES) - set(CppHttp_FOUND TRUE CACHE INTERNAL "cpp-httplib found") - message(STATUS "Found cpp-httplib: ${CPP-HTTP_INCLUDE_DIR}, ${CPP-HTTP_LIBRARIES}") - else() - set(CppHttp_FOUND FALSE CACHE INTERNAL "cpp-httplib found") - message(STATUS "Cpp-httplib not found.") - endif() + + find_package_handle_standard_args(CppHttp REQUIRED_VARS CPP-HTTP_INCLUDE_DIR CPP-HTTP_LIBRARIES VERSION_VAR HTTP_TMP_VERSION) endif()