summaryrefslogtreecommitdiffstats
path: root/project/cmake/modules/FindSSH.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'project/cmake/modules/FindSSH.cmake')
-rw-r--r--project/cmake/modules/FindSSH.cmake52
1 files changed, 39 insertions, 13 deletions
diff --git a/project/cmake/modules/FindSSH.cmake b/project/cmake/modules/FindSSH.cmake
index 60c3537..538c699 100644
--- a/project/cmake/modules/FindSSH.cmake
+++ b/project/cmake/modules/FindSSH.cmake
@@ -1,21 +1,47 @@
1# - Try to find libssh 1#.rst:
2# Once done this will define 2# FindSSH
3# -------
4# Finds the SSH library
3# 5#
4# SSH_FOUND - system has libssh 6# This will will define the following variables::
5# SSH_INCLUDE_DIRS - the libssh include directory 7#
6# SSH_LIBRARIES - The libssh libraries 8# SSH_FOUND - system has SSH
9# SSH_INCLUDE_DIRS - the SSH include directory
10# SSH_LIBRARIES - the SSH libraries
11# SSH_DEFINITIONS - the SSH definitions
12#
13# and the following imported targets::
14#
15# SSH::SSH - The SSH library
7 16
8if(PKG_CONFIG_FOUND) 17if(PKG_CONFIG_FOUND)
9 pkg_check_modules (SSH libssh) 18 pkg_check_modules(PC_SSH libssh QUIET)
10 list(APPEND SSH_INCLUDE_DIRS /usr/include)
11else()
12 find_path(SSH_INCLUDE_DIRS libssh/libssh.h)
13 find_library(SSH_LIBRARIES ssh)
14endif() 19endif()
15 20
21find_path(SSH_INCLUDE_DIR NAMES libssh/libssh.h
22 PATHS ${PC_SSH_INCLUDEDIR})
23find_library(SSH_LIBRARY NAMES ssh
24 PATHS ${PC_SSH_LIBDIR})
25
26set(SSH_VERSION ${PC_SSH_VERSION})
27
16include(FindPackageHandleStandardArgs) 28include(FindPackageHandleStandardArgs)
17find_package_handle_standard_args(SSH DEFAULT_MSG SSH_INCLUDE_DIRS SSH_LIBRARIES) 29find_package_handle_standard_args(SSH
30 REQUIRED_VARS SSH_LIBRARY SSH_INCLUDE_DIR
31 VERSION_VAR SSH_VERSION)
32
33if(SSH_FOUND)
34 set(SSH_LIBRARIES ${SSH_LIBRARY})
35 set(SSH_INCLUDE_DIRS ${SSH_INCLUDE_DIR})
36 set(SSH_DEFINITIONS -DHAVE_LIBSSH=1)
18 37
19list(APPEND SSH_DEFINITIONS -DHAVE_LIBSSH=1) 38 if(NOT TARGET SSH::SSH)
39 add_library(SSH::SSH UNKNOWN IMPORTED)
40 set_target_properties(SSH::SSH PROPERTIES
41 IMPORTED_LOCATION "${SSH_LIBRARY}"
42 INTERFACE_INCLUDE_DIRECTORIES "${SSH_INCLUDE_DIR}"
43 INTERFACE_COMPILE_DEFINITIONS HAVE_LIBSSH=1)
44 endif()
45endif()
20 46
21mark_as_advanced(SSH_INCLUDE_DIRS SSH_LIBRARIES SSH_DEFINITIONS) 47mark_as_advanced(SSH_INCLUDE_DIR SSH_LIBRARY)