mirror of
https://github.com/curl/curl.git
synced 2024-11-27 05:50:21 +08:00
cmake: detect libssh
via pkg-config
Also: - fix broken libssh `pkg-config` behaviour on old Linux. (when found, `LIBSSH_LINK_LIBRARIES` remains undefined.) - delete manual libssh config from Old Linux CI job, it's no longer necessary. Closes #14199
This commit is contained in:
parent
efce544418
commit
e8acb2e55a
3
.github/workflows/linux-old.yml
vendored
3
.github/workflows/linux-old.yml
vendored
@ -89,8 +89,7 @@ jobs:
|
||||
run: |
|
||||
mkdir bld-cares
|
||||
cd bld-cares
|
||||
cmake .. -DCMAKE_UNITY_BUILD=ON -DCURL_WERROR=ON -DBUILD_SHARED_LIBS=ON -DENABLE_ARES=ON -DCURL_ZSTD=ON -DCURL_USE_GSSAPI=ON -DCURL_USE_LIBSSH2=OFF \
|
||||
-DUSE_LIBSSH=ON '-DCMAKE_C_FLAGS=-I/usr/include -L/usr/lib -lssh'
|
||||
cmake .. -DCMAKE_UNITY_BUILD=ON -DCURL_WERROR=ON -DBUILD_SHARED_LIBS=ON -DENABLE_ARES=ON -DCURL_ZSTD=ON -DCURL_USE_GSSAPI=ON -DCURL_USE_LIBSSH2=OFF -DCURL_USE_LIBSSH=ON
|
||||
|
||||
- name: 'build'
|
||||
run: |
|
||||
|
@ -994,11 +994,21 @@ 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)
|
||||
find_package(libssh CONFIG QUIET)
|
||||
if(libssh_FOUND)
|
||||
message(STATUS "Found libssh ${libssh_VERSION}")
|
||||
# Use imported target for include and library paths.
|
||||
list(APPEND CURL_LIBS ssh)
|
||||
else()
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(LIBSSH "libssh")
|
||||
if(LIBSSH_FOUND)
|
||||
include_directories(${LIBSSH_INCLUDE_DIRS})
|
||||
endif()
|
||||
endif()
|
||||
if(libssh_FOUND OR LIBSSH_FOUND)
|
||||
if(NOT DEFINED LIBSSH_LINK_LIBRARIES)
|
||||
set(LIBSSH_LINK_LIBRARIES "ssh") # for find_package() with broken pkg-config (e.g. linux-old CI workflow)
|
||||
endif()
|
||||
list(APPEND CURL_LIBS ${LIBSSH_LINK_LIBRARIES})
|
||||
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libssh")
|
||||
set(USE_LIBSSH ON)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user