xref: /curl/CMake/FindBearSSL.cmake (revision f66af623)
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_LIBRARY`:       Path to `bearssl` library.
30#
31# Result variables:
32#
33# - `BEARSSL_FOUND`:         System has BearSSL.
34# - `BEARSSL_INCLUDE_DIRS`:  The BearSSL include directories.
35# - `BEARSSL_LIBRARIES`:     The BearSSL library names.
36
37if(DEFINED BEARSSL_INCLUDE_DIRS AND NOT DEFINED BEARSSL_INCLUDE_DIR)
38  message(WARNING "BEARSSL_INCLUDE_DIRS is deprecated, use BEARSSL_INCLUDE_DIR instead.")
39  set(BEARSSL_INCLUDE_DIR "${BEARSSL_INCLUDE_DIRS}")
40  unset(BEARSSL_INCLUDE_DIRS)
41endif()
42
43find_path(BEARSSL_INCLUDE_DIR NAMES "bearssl.h")
44find_library(BEARSSL_LIBRARY NAMES "bearssl")
45
46include(FindPackageHandleStandardArgs)
47find_package_handle_standard_args(BearSSL
48  REQUIRED_VARS
49    BEARSSL_INCLUDE_DIR
50    BEARSSL_LIBRARY
51)
52
53if(BEARSSL_FOUND)
54  set(BEARSSL_INCLUDE_DIRS ${BEARSSL_INCLUDE_DIR})
55  set(BEARSSL_LIBRARIES    ${BEARSSL_LIBRARY})
56endif()
57
58mark_as_advanced(BEARSSL_INCLUDE_DIR BEARSSL_LIBRARY)
59