2021-03-07 02:40:21 +02:00
|
|
|
# Try to find LibSSH, once done this will define:
|
2015-11-05 10:05:41 +02:00
|
|
|
#
|
|
|
|
# LIBSSH_FOUND - system has LibSSH
|
|
|
|
# LIBSSH_INCLUDE_DIRS - the LibSSH include directory
|
2020-02-21 17:44:22 +00:00
|
|
|
# LIBSSH_LIBRARIES - the libraries needed to use LibSSH
|
|
|
|
# LIBSSH_DEFINITIONS - compiler switches required for using LibSSH
|
2015-11-05 10:05:41 +02:00
|
|
|
#
|
2021-03-07 02:40:21 +02:00
|
|
|
# Copyright (c) 2020 Ivailo Monev <xakepa10@gmail.com>
|
2015-11-05 10:05:41 +02:00
|
|
|
#
|
2020-02-21 17:44:22 +00:00
|
|
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
|
|
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
2015-11-05 10:05:41 +02:00
|
|
|
|
2020-02-21 17:44:22 +00:00
|
|
|
if(NOT WIN32)
|
|
|
|
include(FindPkgConfig)
|
|
|
|
pkg_check_modules(PC_LIBSSH QUIET libssh)
|
2015-11-05 10:05:41 +02:00
|
|
|
|
2020-02-21 17:44:22 +00:00
|
|
|
set(LIBSSH_INCLUDE_DIR ${PC_LIBSSH_INCLUDE_DIRS})
|
|
|
|
set(LIBSSH_LIBRARIES ${PC_LIBSSH_LIBRARIES})
|
|
|
|
endif()
|
2015-11-05 10:05:41 +02:00
|
|
|
|
2020-02-21 17:44:22 +00:00
|
|
|
set(LIBSSH_VERSION ${PC_LIBSSH_VERSION})
|
|
|
|
set(LIBSSH_DEFINITIONS ${PC_LIBSSH_CFLAGS_OTHER})
|
2015-11-05 10:05:41 +02:00
|
|
|
|
2020-02-21 17:44:22 +00:00
|
|
|
if(NOT LIBSSH_INCLUDE_DIR OR NOT LIBSSH_LIBRARIES)
|
|
|
|
find_path(LIBSSH_INCLUDE_DIR
|
|
|
|
NAMES libssh/libssh.h
|
|
|
|
HINTS $ENV{LIBSSHDIR}/include
|
|
|
|
)
|
2015-11-05 10:05:41 +02:00
|
|
|
|
2020-02-21 17:44:22 +00:00
|
|
|
find_library(LIBSSH_LIBRARIES
|
|
|
|
NAMES ssh
|
|
|
|
HINTS $ENV{LIBSSHDIR}/lib
|
|
|
|
)
|
|
|
|
endif()
|
2015-11-05 10:05:41 +02:00
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(LibSSH
|
2020-02-21 17:44:22 +00:00
|
|
|
VERSION_VAR LIBSSH_VERSION
|
|
|
|
REQUIRED_VARS LIBSSH_LIBRARIES LIBSSH_INCLUDE_DIR
|
|
|
|
)
|
2015-11-05 10:05:41 +02:00
|
|
|
|
|
|
|
mark_as_advanced(LIBSSH_INCLUDE_DIR LIBSSH_LIBRARIES)
|