xref: /curl/CMake/FindBearSSL.cmake (revision 3a2e47af)
1#***************************************************************************
2#                                  _   _ ____  _
3#  Project                     ___| | | |  _ \| |
4#                             / __| | | | |_) | |
5#                            | (__| |_| |  _ <| |___
6#                             \___|\___/|_| \_\_____|
7#
8# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, 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 bearssl library
25#
26# Input variables:
27#
28# BEARSSL_INCLUDE_DIR   The bearssl include directory
29# BEARSSL_INCLUDE_DIRS  The bearssl include directory (deprecated)
30# BEARSSL_LIBRARY       Path to bearssl library
31#
32# Result variables:
33#
34# BEARSSL_FOUND         System has bearssl
35# BEARSSL_INCLUDE_DIRS  The bearssl include directories
36# BEARSSL_LIBRARIES     The bearssl library names
37
38if(DEFINED BEARSSL_INCLUDE_DIRS AND NOT DEFINED BEARSSL_INCLUDE_DIR)
39  message(WARNING "BEARSSL_INCLUDE_DIRS is deprecated, use BEARSSL_INCLUDE_DIR instead.")
40  set(BEARSSL_INCLUDE_DIR "${BEARSSL_INCLUDE_DIRS}")
41  unset(BEARSSL_INCLUDE_DIRS)
42endif()
43
44find_path(BEARSSL_INCLUDE_DIR NAMES "bearssl.h")
45find_library(BEARSSL_LIBRARY NAMES "bearssl")
46
47include(FindPackageHandleStandardArgs)
48find_package_handle_standard_args(BearSSL
49  REQUIRED_VARS
50    BEARSSL_INCLUDE_DIR
51    BEARSSL_LIBRARY
52)
53
54if(BEARSSL_FOUND)
55  set(BEARSSL_INCLUDE_DIRS ${BEARSSL_INCLUDE_DIR})
56  set(BEARSSL_LIBRARIES    ${BEARSSL_LIBRARY})
57endif()
58
59mark_as_advanced(BEARSSL_INCLUDE_DIR BEARSSL_LIBRARY)
60