Debian Codegraph @

extra/curl/curl-8.14.1/CMake/FindWolfSSH.cmake

raw
1 #***************************************************************************
2 # _ _ ____ _
3 # Project ___| | | | _ \| |
4 # / __| | | | |_) | |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
7 #
8 # Copyright (C) Daniel Stenberg, <[email protected]>, et al.
9 #
10 # This software is licensed as described in the file COPYING, which
11 # you should have received as part of this distribution. The terms
12 # are also available at https://curl.se/docs/copyright.html.
13 #
14 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 # copies of the Software, and permit persons to whom the Software is
16 # furnished to do so, under the terms of the COPYING file.
17 #
18 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 # KIND, either express or implied.
20 #
21 # SPDX-License-Identifier: curl
22 #
23 ###########################################################################
24 # Find the wolfSSH library
25 #
26 # Input variables:
27 #
28 # - `WOLFSSH_INCLUDE_DIR`: The wolfSSH include directory.
29 # - `WOLFSSH_LIBRARY`: Path to `wolfssh` library.
30 #
31 # Result variables:
32 #
33 # - `WOLFSSH_FOUND`: System has wolfSSH.
34 # - `WOLFSSH_INCLUDE_DIRS`: The wolfSSH include directories.
35 # - `WOLFSSH_LIBRARIES`: The wolfSSH library names.
36 # - `WOLFSSH_VERSION`: Version of wolfSSH.
37
38 find_path(WOLFSSH_INCLUDE_DIR NAMES "wolfssh/ssh.h")
39 find_library(WOLFSSH_LIBRARY NAMES "wolfssh" "libwolfssh")
40
41 unset(WOLFSSH_VERSION CACHE)
42 if(WOLFSSH_INCLUDE_DIR AND EXISTS "${WOLFSSH_INCLUDE_DIR}/wolfssh/version.h")
43 set(_version_regex "#[\t ]*define[\t ]+LIBWOLFSSH_VERSION_STRING[\t ]+\"([^\"]*)\"")
44 file(STRINGS "${WOLFSSH_INCLUDE_DIR}/wolfssh/version.h" _version_str REGEX "${_version_regex}")
45 string(REGEX REPLACE "${_version_regex}" "\\1" _version_str "${_version_str}")
46 set(WOLFSSH_VERSION "${_version_str}")
47 unset(_version_regex)
48 unset(_version_str)
49 endif()
50
51 include(FindPackageHandleStandardArgs)
52 find_package_handle_standard_args(WolfSSH
53 REQUIRED_VARS
54 WOLFSSH_INCLUDE_DIR
55 WOLFSSH_LIBRARY
56 VERSION_VAR
57 WOLFSSH_VERSION
58 )
59
60 if(WOLFSSH_FOUND)
61 set(WOLFSSH_INCLUDE_DIRS ${WOLFSSH_INCLUDE_DIR})
62 set(WOLFSSH_LIBRARIES ${WOLFSSH_LIBRARY})
63 endif()
64
65 mark_as_advanced(WOLFSSH_INCLUDE_DIR WOLFSSH_LIBRARY)