diff options
Diffstat (limited to 'project/cmake/modules/FindSSH.cmake')
| -rw-r--r-- | project/cmake/modules/FindSSH.cmake | 52 |
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 | ||
| 8 | if(PKG_CONFIG_FOUND) | 17 | if(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) | ||
| 11 | else() | ||
| 12 | find_path(SSH_INCLUDE_DIRS libssh/libssh.h) | ||
| 13 | find_library(SSH_LIBRARIES ssh) | ||
| 14 | endif() | 19 | endif() |
| 15 | 20 | ||
| 21 | find_path(SSH_INCLUDE_DIR NAMES libssh/libssh.h | ||
| 22 | PATHS ${PC_SSH_INCLUDEDIR}) | ||
| 23 | find_library(SSH_LIBRARY NAMES ssh | ||
| 24 | PATHS ${PC_SSH_LIBDIR}) | ||
| 25 | |||
| 26 | set(SSH_VERSION ${PC_SSH_VERSION}) | ||
| 27 | |||
| 16 | include(FindPackageHandleStandardArgs) | 28 | include(FindPackageHandleStandardArgs) |
| 17 | find_package_handle_standard_args(SSH DEFAULT_MSG SSH_INCLUDE_DIRS SSH_LIBRARIES) | 29 | find_package_handle_standard_args(SSH |
| 30 | REQUIRED_VARS SSH_LIBRARY SSH_INCLUDE_DIR | ||
| 31 | VERSION_VAR SSH_VERSION) | ||
| 32 | |||
| 33 | if(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 | ||
| 19 | list(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() | ||
| 45 | endif() | ||
| 20 | 46 | ||
| 21 | mark_as_advanced(SSH_INCLUDE_DIRS SSH_LIBRARIES SSH_DEFINITIONS) | 47 | mark_as_advanced(SSH_INCLUDE_DIR SSH_LIBRARY) |
