From 576b39b6d0da783f60f9b0f4ac415b6d63292a13 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 20 Aug 2024 15:44:28 +0200 Subject: [PATCH] cmake: drop libssh CONFIG-style detection 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 | 5 +++-- CMakeLists.txt | 17 ++++++----------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 96ea83df96..52edbc33a1 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 3531b93f1a..2c487553ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() -- 2.47.3