From: Viktor Szakats Date: Thu, 31 Oct 2024 11:26:37 +0000 (+0100) Subject: cmake: drop redundant FOUND checks (libgsasl, libssh, libuv) X-Git-Tag: curl-8_12_0~342 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=05ba3534356cc07f98763cfbea43e4f592df14e4;p=thirdparty%2Fcurl.git cmake: drop redundant FOUND checks (libgsasl, libssh, libuv) With `find_package(... REQUIRED)` the configuration fails and exits if the package is not found. The `..._FOUND` check afterwards always evaluates true and safe to delete. Also true for brotli and zstd, but those are addressed differently via #15431. Closes #15465 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index eb3108766d..7ba851ea92 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1173,17 +1173,15 @@ option(CURL_USE_LIBSSH "Use libssh" OFF) mark_as_advanced(CURL_USE_LIBSSH) if(NOT USE_LIBSSH2 AND CURL_USE_LIBSSH) find_package(Libssh REQUIRED) - if(LIBSSH_FOUND) - list(APPEND CURL_LIBS ${LIBSSH_LIBRARIES}) - list(APPEND CURL_LIBDIRS ${LIBSSH_LIBRARY_DIRS}) - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libssh") - include_directories(SYSTEM ${LIBSSH_INCLUDE_DIRS}) - link_directories(${LIBSSH_LIBRARY_DIRS}) - if(LIBSSH_CFLAGS) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBSSH_CFLAGS}") - endif() - set(USE_LIBSSH ON) + list(APPEND CURL_LIBS ${LIBSSH_LIBRARIES}) + list(APPEND CURL_LIBDIRS ${LIBSSH_LIBRARY_DIRS}) + list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libssh") + include_directories(SYSTEM ${LIBSSH_INCLUDE_DIRS}) + link_directories(${LIBSSH_LIBRARY_DIRS}) + if(LIBSSH_CFLAGS) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBSSH_CFLAGS}") endif() + set(USE_LIBSSH ON) endif() # wolfSSH @@ -1207,17 +1205,15 @@ option(CURL_USE_GSASL "Use libgsasl" OFF) mark_as_advanced(CURL_USE_GSASL) if(CURL_USE_GSASL) find_package(Libgsasl REQUIRED) - if(LIBGSASL_FOUND) - list(APPEND CURL_LIBS ${LIBGSASL_LIBRARIES}) - list(APPEND CURL_LIBDIRS ${LIBGSASL_LIBRARY_DIRS}) - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libgsasl") - include_directories(SYSTEM ${LIBGSASL_INCLUDE_DIRS}) - link_directories(${LIBGSASL_LIBRARY_DIRS}) - if(LIBGSASL_CFLAGS) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBGSASL_CFLAGS}") - endif() - set(USE_GSASL ON) + list(APPEND CURL_LIBS ${LIBGSASL_LIBRARIES}) + list(APPEND CURL_LIBDIRS ${LIBGSASL_LIBRARY_DIRS}) + list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libgsasl") + include_directories(SYSTEM ${LIBGSASL_INCLUDE_DIRS}) + link_directories(${LIBGSASL_LIBRARY_DIRS}) + if(LIBGSASL_CFLAGS) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBGSASL_CFLAGS}") endif() + set(USE_GSASL ON) endif() option(CURL_USE_GSSAPI "Use GSSAPI implementation" OFF) @@ -1284,18 +1280,16 @@ if(CURL_USE_LIBUV) message(FATAL_ERROR "Using libuv without debug support enabled is useless") endif() find_package(Libuv REQUIRED) - if(LIBUV_FOUND) - list(APPEND CURL_LIBS ${LIBUV_LIBRARIES}) - list(APPEND CURL_LIBDIRS ${LIBUV_LIBRARY_DIRS}) - list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libuv") - include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS}) - link_directories(${LIBUV_LIBRARY_DIRS}) - if(LIBUV_CFLAGS) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUV_CFLAGS}") - endif() - set(USE_LIBUV ON) - set(HAVE_UV_H ON) - endif() + list(APPEND CURL_LIBS ${LIBUV_LIBRARIES}) + list(APPEND CURL_LIBDIRS ${LIBUV_LIBRARY_DIRS}) + list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libuv") + include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS}) + link_directories(${LIBUV_LIBRARY_DIRS}) + if(LIBUV_CFLAGS) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUV_CFLAGS}") + endif() + set(USE_LIBUV ON) + set(HAVE_UV_H ON) endif() option(USE_LIBRTMP "Enable librtmp from rtmpdump" OFF)