FindGnuTLS.cmake 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. # Adapted from FindXml2.cmake, which is:
  10. # Copyright (c) 2006, Alexander Neundorf, <[email protected]>
  11. #
  12. # Changes are Copyright 2009, Brad Hards, <[email protected]>
  13. # Copyright 2009, Philip Lowman, <[email protected]>
  14. #
  15. # Redistribution and use is allowed according to the terms of the BSD license.
  16. # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
  17. #
  18. # Note that this doesn't try to find the gnutls-extra package.
  19. IF (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY)
  20. # in cache already
  21. SET(gnutls_FIND_QUIETLY TRUE)
  22. ENDIF (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY)
  23. IF (NOT WIN32)
  24. # try using pkg-config to get the directories and then use these values
  25. # in the FIND_PATH() and FIND_LIBRARY() calls
  26. # also fills in GNUTLS_DEFINITIONS, although that isn't normally useful
  27. FIND_PACKAGE(PkgConfig)
  28. PKG_CHECK_MODULES(PC_GNUTLS gnutls)
  29. SET(GNUTLS_DEFINITIONS ${PC_GNUTLS_CFLAGS_OTHER})
  30. ENDIF (NOT WIN32)
  31. FIND_PATH(GNUTLS_INCLUDE_DIR gnutls.h
  32. HINTS
  33. ${PC_GNUTLS_INCLUDEDIR}
  34. ${PC_GNUTLS_INCLUDE_DIRS}
  35. PATH_SUFFIXES gnutls
  36. )
  37. FIND_LIBRARY(GNUTLS_LIBRARY NAMES gnutls libgnutls
  38. HINTS
  39. ${PC_GNUTLS_LIBDIR}
  40. ${PC_GNUTLS_LIBRARY_DIRS}
  41. )
  42. # handle the QUIETLY and REQUIRED arguments and set GNUTLS_FOUND to TRUE if
  43. # all listed variables are TRUE
  44. INCLUDE(FindPackageHandleStandardArgs)
  45. FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuTLS DEFAULT_MSG GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR)
  46. MARK_AS_ADVANCED(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY)
  47. SET(GNUTLS_LIBRARIES ${GNUTLS_LIBRARY})
  48. SET(GNUTLS_INCLUDE_DIRS ${GNUTLS_INCLUDE_DIR})