]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: drop redundant FOUND checks (libgsasl, libssh, libuv)
authorViktor Szakats <commit@vsz.me>
Thu, 31 Oct 2024 11:26:37 +0000 (12:26 +0100)
committerViktor Szakats <commit@vsz.me>
Mon, 16 Dec 2024 17:11:15 +0000 (18:11 +0100)
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

CMakeLists.txt

index eb3108766dfd3c3668eb526758bc8ce1539b6d7a..7ba851ea9225e6ecf930c22cc00dc3d9d8d69f29 100644 (file)
@@ -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)