From fec71ae30cc9d54d2a74aa54bb10c89214a13bd9 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Sun, 29 Sep 2024 14:17:05 +0100 Subject: [PATCH] cmake: use pkg_check_modules() for cURL The cURL project has provided a pkg-config file for well over a decade now. Just use that instead of the cmake one, since the latter also checks for misc curl components, unusual library names (libcurl_imp) which is not something we need. In addition, this will make enforcing minimum version much easier. Signed-off-by: Emil Velikov --- CMakeLists.txt | 4 +++- src/core/CMakeLists.txt | 2 -- src/gui/curses/CMakeLists.txt | 2 -- tests/CMakeLists.txt | 1 - 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 89e67a618..db1d891fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -239,7 +239,9 @@ if(ICONV_FOUND) endif() # Check for CURL -find_package(CURL REQUIRED) +pkg_check_modules(LIBCURL REQUIRED libcurl) +include_directories(${LIBCURL_INCLUDE_DIRS}) +list(APPEND EXTRA_LIBS ${LIBCURL_LDFLAGS}) find_library(DL_LIBRARY NAMES dl diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index c2944d1c5..f76b71740 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -89,8 +89,6 @@ endif() include_directories(${GNUTLS_INCLUDE_PATH}) -include_directories(${CURL_INCLUDE_DIRS}) - if(ENABLE_ZSTD) include_directories(${LIBZSTD_INCLUDE_DIRS}) endif() diff --git a/src/gui/curses/CMakeLists.txt b/src/gui/curses/CMakeLists.txt index 698357e41..521f22a76 100644 --- a/src/gui/curses/CMakeLists.txt +++ b/src/gui/curses/CMakeLists.txt @@ -45,8 +45,6 @@ endif() list(APPEND EXTRA_LIBS "m") -list(APPEND EXTRA_LIBS ${CURL_LIBRARIES}) - list(APPEND EXTRA_LIBS ${ZLIB_LIBRARY}) if(ENABLE_ZSTD) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6074e0938..d63e497b3 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -228,7 +228,6 @@ target_link_libraries(tests weechat_ncurses_fake weechat_unit_tests_core ${EXTRA_LIBS} - ${CURL_LIBRARIES} ${ZLIB_LIBRARY} ${LIBZSTD_LDFLAGS} ${CPPUTEST_LIBRARIES}