FindGnuTLS.cmake 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # - Try to find the GNU Transport Layer Security library (gnutls)
  2. #
  3. # Once done this will define
  4. #
  5. # GNUTLS_FOUND - System has gnutls
  6. # GNUTLS_INCLUDE_DIR - The gnutls include directory
  7. # GNUTLS_LIBRARIES - The libraries needed to use gnutls
  8. # GNUTLS_DEFINITIONS - Compiler switches required for using gnutls
  9. #=============================================================================
  10. # Copyright 2009 Kitware, Inc.
  11. # Copyright 2009 Philip Lowman <[email protected]>
  12. # Copyright 2009 Brad Hards <[email protected]>
  13. # Copyright 2006 Alexander Neundorf <[email protected]>
  14. #
  15. # Distributed under the OSI-approved BSD License (the "License");
  16. # see accompanying file Copyright.txt for details.
  17. #
  18. # This software is distributed WITHOUT ANY WARRANTY; without even the
  19. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  20. # See the License for more information.
  21. #=============================================================================
  22. # (To distribute this file outside of CMake, substitute the full
  23. # License text for the above reference.)
  24. # Note that this doesn't try to find the gnutls-extra package.
  25. IF (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY)
  26. # in cache already
  27. SET(gnutls_FIND_QUIETLY TRUE)
  28. ENDIF (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY)
  29. IF (NOT WIN32)
  30. # try using pkg-config to get the directories and then use these values
  31. # in the FIND_PATH() and FIND_LIBRARY() calls
  32. # also fills in GNUTLS_DEFINITIONS, although that isn't normally useful
  33. FIND_PACKAGE(PkgConfig)
  34. PKG_CHECK_MODULES(PC_GNUTLS gnutls)
  35. SET(GNUTLS_DEFINITIONS ${PC_GNUTLS_CFLAGS_OTHER})
  36. ENDIF (NOT WIN32)
  37. FIND_PATH(GNUTLS_INCLUDE_DIR gnutls/gnutls.h
  38. HINTS
  39. ${PC_GNUTLS_INCLUDEDIR}
  40. ${PC_GNUTLS_INCLUDE_DIRS}
  41. )
  42. FIND_LIBRARY(GNUTLS_LIBRARY NAMES gnutls libgnutls
  43. HINTS
  44. ${PC_GNUTLS_LIBDIR}
  45. ${PC_GNUTLS_LIBRARY_DIRS}
  46. )
  47. MARK_AS_ADVANCED(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY)
  48. # handle the QUIETLY and REQUIRED arguments and set GNUTLS_FOUND to TRUE if
  49. # all listed variables are TRUE
  50. INCLUDE(FindPackageHandleStandardArgs)
  51. FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuTLS DEFAULT_MSG GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR)
  52. IF(GNUTLS_FOUND)
  53. SET(GNUTLS_LIBRARIES ${GNUTLS_LIBRARY})
  54. SET(GNUTLS_INCLUDE_DIRS ${GNUTLS_INCLUDE_DIR})
  55. ENDIF()