FindBearSSL.cmake 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. if(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)
  41. endif()
  42. find_path(BEARSSL_INCLUDE_DIR NAMES "bearssl.h")
  43. find_library(BEARSSL_LIBRARY NAMES "bearssl")
  44. include(FindPackageHandleStandardArgs)
  45. find_package_handle_standard_args(BearSSL
  46. REQUIRED_VARS
  47. BEARSSL_INCLUDE_DIR
  48. BEARSSL_LIBRARY
  49. )
  50. if(BEARSSL_FOUND)
  51. set(BEARSSL_INCLUDE_DIRS ${BEARSSL_INCLUDE_DIR})
  52. set(BEARSSL_LIBRARIES ${BEARSSL_LIBRARY})
  53. endif()
  54. mark_as_advanced(BEARSSL_INCLUDE_DIR BEARSSL_LIBRARY)