dropshell/cmake/FindLibSSH.cmake
Your Name 61218f8866
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 21s
colour
2025-05-10 16:56:54 +12:00

35 lines
1.0 KiB
CMake

# - Try to find LibSSH
# Once done this will define
# LIBSSH_FOUND - System has LibSSH
# LIBSSH_INCLUDE_DIRS - The LibSSH include directories
# LIBSSH_LIBRARIES - The libraries needed to use LibSSH
# LIBSSH_DEFINITIONS - Compiler switches required for using LibSSH
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_LIBSSH QUIET libssh)
set(LIBSSH_DEFINITIONS ${PC_LIBSSH_CFLAGS_OTHER})
endif()
find_path(LIBSSH_INCLUDE_DIR
NAMES libssh/libssh.h
HINTS ${PC_LIBSSH_INCLUDEDIR} ${PC_LIBSSH_INCLUDE_DIRS}
PATH_SUFFIXES libssh
)
find_library(LIBSSH_LIBRARY
NAMES ssh libssh
HINTS ${PC_LIBSSH_LIBDIR} ${PC_LIBSSH_LIBRARY_DIRS}
)
include(FindPackageHandleStandardArgs)
# Handle the QUIETLY and REQUIRED arguments and set LIBSSH_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(LibSSH DEFAULT_MSG
LIBSSH_LIBRARY LIBSSH_INCLUDE_DIR
)
mark_as_advanced(LIBSSH_INCLUDE_DIR LIBSSH_LIBRARY)
set(LIBSSH_LIBRARIES ${LIBSSH_LIBRARY})
set(LIBSSH_INCLUDE_DIRS ${LIBSSH_INCLUDE_DIR})