File: FindwolfSSL.cmake

package info (click to toggle)
libcoap3 4.3.5-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 5,368 kB
  • sloc: ansic: 60,037; makefile: 1,280; sh: 938; python: 6
file content (86 lines) | stat: -rw-r--r-- 1,950 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# FindWolfSSL.cmake
# -----------------
#
# Find the wolfSSL library.
#
# Imported Targets
# ^^^^^^^^^^^^^^^^
#
# This module defines the following :prop_tgt:`IMPORTED` targets:
#
# ``wolfssl``
#   The wolfSSL library, if found.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This module will set the following variables in your project:
#
# ``wolfSSL_FOUND``
#   System has the wolfSSL library.
# ``WOLFSSL_INCLUDE_DIR``
#   The wolfSSL include directory.
# ``WOLFSSL_LIBRARIES``
#   All wolfSSL libraries.
#
# Hints
# ^^^^^
#
# Set ``WOLFSSL_ROOT_DIR`` to the root directory of a wolfSSL installation.

if(WOLFSSL_ROOT_DIR)
  set(_WOLFSSL_EXTRA_FIND_ARGS "NO_CMAKE_FIND_ROOT_PATH")
endif()

find_path(
  WOLFSSL_INCLUDE_DIR
  NAMES wolfssl/ssl.h
  PATH_SUFFIXES include
  HINTS ${PROJECT_SOURCE_DIR}
        ${CMAKE_CURRENT_BINARY_DIR}
        ${WOLFSSL_ROOT_DIR}
        ${_WOLFSSL_EXTRA_FIND_ARGS})

find_library(
  WOLFSSL_LIBRARIES
  NAMES wolfssl
  PATH_SUFFIXES lib
  HINTS ${PROJECT_SOURCE_DIR}
        ${CMAKE_CURRENT_BINARY_DIR}
        ${WOLFSSL_ROOT_DIR}
        ${_WOLFSSL_EXTRA_FIND_ARGS})

if(WOLFSSL_LIBRARIES)
  set(wolfSSL_FOUND TRUE)
else()
  set(wolfSSL_FOUND FALSE)
  if(wolfSSL_FIND_REQUIRED)
    message(FATAL_ERROR "wolfSSL could not be found")
  endif()
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
  wolfSSL
  FOUND_VAR
  wolfSSL_FOUND
  REQUIRED_VARS
  WOLFSSL_INCLUDE_DIR
  WOLFSSL_LIBRARIES
  VERSION_VAR)

if(NOT TARGET wolfssl)
  add_library(
    wolfssl
    UNKNOWN
    IMPORTED)
  set_target_properties(
    wolfssl
    PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${WOLFSSL_INCLUDE_DIR}"
               IMPORTED_LINK_INTERFACE_LANGUAGES "C"
               IMPORTED_LOCATION "${WOLFSSL_LIBRARIES}")
endif()

message(STATUS "WOLFSSL_INCLUDE_DIR: ${WOLFSSL_INCLUDE_DIR}")
message(STATUS "WOLFSSL_LIBRARIES: ${WOLFSSL_LIBRARIES}")
message(STATUS "WOLFSSL_ROOT_DIR: ${WOLFSSL_ROOT_DIR}")