]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: drop libssh CONFIG-style detection
authorViktor Szakats <commit@vsz.me>
Tue, 20 Aug 2024 13:44:28 +0000 (15:44 +0200)
committerViktor Szakats <commit@vsz.me>
Wed, 21 Aug 2024 08:07:13 +0000 (10:07 +0200)
Drop `find_package(libssh CONFIG)` detection method in favour of
the Find module that supports both `pkg-config`, and CMake-native
(since #14555) detection.

This aligns `libssh` detection with other dependencies. It makes the
build honor custom configuration via `LIBSSH_INCLUDE_DIR`,
`LIBSSH_LIBRARY`.

Also enable libssh in a GHA/macos cmake job for build coverage.

Fixing:
- curl-for-win requiring a hack to configure libssh:
  https://github.com/curl/curl-for-win/blob/4f9acbed92fd4aac0e874c9a591bec7d621cd9f2/curl.sh#L255-L263
- after #14555, GHA/windows gnutls vcpkg job no longer auto-detected
  libssh, due to a regression missing to enable libssh when
  found via `find_package(libssh CONFIG)`.
  Ref: https://github.com/curl/curl/actions/runs/10470138955/job/28994650338

Follow-up to 422696f0a4f3a9e20d4ba9f12726bb066f1c34fc #14555

Closes #14614

.github/workflows/macos.yml
CMakeLists.txt

index 96ea83df96f36376dc641af5d1c9e1477284164c..52edbc33a197ac6118a6ad6d01d7af88cbc14587 100644 (file)
@@ -278,8 +278,9 @@ jobs:
             install: gsasl
             generate: -DOPENSSL_ROOT_DIR=$(brew --prefix openssl) -DCURL_USE_GSASL=ON -DUSE_APPLE_IDN=ON -DENABLE_WEBSOCKETS=ON
             macos-version-min: '10.9'
-          - name: 'OpenSSL +static'
-            generate: -DOPENSSL_ROOT_DIR=$(brew --prefix openssl) -DBUILD_STATIC_LIBS=ON
+          - name: 'OpenSSL +static libssh'
+            install: libssh
+            generate: -DOPENSSL_ROOT_DIR=$(brew --prefix openssl) -DBUILD_STATIC_LIBS=ON -DCURL_USE_LIBSSH2=OFF -DCURL_USE_LIBSSH=ON
             macos-version-min: '10.9'
           - name: 'SecureTransport ws debug+'
             generate: -DCURL_USE_SECTRANSP=ON -DENABLE_WEBSOCKETS=ON -DENABLE_DEBUG=ON -DENABLE_CURLDEBUG=ON
index 3531b93f1acb4a3940ba1c6e9e9c7424063fd487..2c487553ecfccb2356723542febe3c73a1d094a2 100644 (file)
@@ -1066,17 +1066,12 @@ endif()
 option(CURL_USE_LIBSSH "Use libssh" OFF)
 mark_as_advanced(CURL_USE_LIBSSH)
 if(NOT USE_LIBSSH2 AND CURL_USE_LIBSSH)
-  find_package(libssh CONFIG QUIET)
-  if(libssh_FOUND)
-    message(STATUS "Found libssh ${libssh_VERSION}")
-  else()
-    find_package(Libssh REQUIRED)
-    if(LIBSSH_FOUND)
-      list(APPEND CURL_LIBS ${LIBSSH_LIBRARIES})
-      list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libssh")
-      include_directories(${LIBSSH_INCLUDE_DIRS})
-      set(USE_LIBSSH ON)
-    endif()
+  find_package(Libssh REQUIRED)
+  if(LIBSSH_FOUND)
+    list(APPEND CURL_LIBS ${LIBSSH_LIBRARIES})
+    list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libssh")
+    include_directories(${LIBSSH_INCLUDE_DIRS})
+    set(USE_LIBSSH ON)
   endif()
 endif()