FindRustls.cmake 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 rustls library
  25. #
  26. # Input variables:
  27. #
  28. # RUSTLS_INCLUDE_DIR The rustls include directory
  29. # RUSTLS_LIBRARY Path to rustls library
  30. #
  31. # Result variables:
  32. #
  33. # RUSTLS_FOUND System has rustls
  34. # RUSTLS_INCLUDE_DIRS The rustls include directories
  35. # RUSTLS_LIBRARIES The rustls library names
  36. # RUSTLS_VERSION Version of rustls
  37. if(CURL_USE_PKGCONFIG)
  38. find_package(PkgConfig QUIET)
  39. pkg_check_modules(PC_RUSTLS "rustls")
  40. endif()
  41. find_path(RUSTLS_INCLUDE_DIR NAMES "rustls.h"
  42. HINTS
  43. ${PC_RUSTLS_INCLUDEDIR}
  44. ${PC_RUSTLS_INCLUDE_DIRS}
  45. )
  46. find_library(RUSTLS_LIBRARY NAMES "rustls"
  47. HINTS
  48. ${PC_RUSTLS_LIBDIR}
  49. ${PC_RUSTLS_LIBRARY_DIRS}
  50. )
  51. if(PC_RUSTLS_VERSION)
  52. set(RUSTLS_VERSION ${PC_RUSTLS_VERSION})
  53. endif()
  54. include(FindPackageHandleStandardArgs)
  55. find_package_handle_standard_args(Rustls
  56. REQUIRED_VARS
  57. RUSTLS_INCLUDE_DIR
  58. RUSTLS_LIBRARY
  59. VERSION_VAR
  60. RUSTLS_VERSION
  61. )
  62. if(RUSTLS_FOUND)
  63. set(RUSTLS_INCLUDE_DIRS ${RUSTLS_INCLUDE_DIR})
  64. set(RUSTLS_LIBRARIES ${RUSTLS_LIBRARY})
  65. endif()
  66. mark_as_advanced(RUSTLS_INCLUDE_DIR RUSTLS_LIBRARY)