khanat-opennel-code/code/CMakeModules/Findgnutls.cmake

72 lines
1.5 KiB
CMake
Raw Permalink Normal View History

# - Locate gnutls library
# This module defines
# GNUTLS_LIBRARY, the library to link against
# GNUTLS_FOUND, if false, do not try to link to JPEG
# GNUTLS_INCLUDE_DIR, where to find headers.
IF(NOT UNIX)
MESSAGE(STATUS "Ignore gnutls: It's not Unix enviroment")
RETURN()
ENDIF()
GET_CMAKE_PROPERTY(_variableNames VARIABLES)
LIST (SORT _variableNames)
FOREACH (_variableName ${_variableNames})
MESSAGE(STATUS "${_variableName}=${${_variableName}}")
ENDFOREACH()
IF(GNUTLS_LIBRARY AND GNUTLS_INCLUDE_DIR)
# in cache already
SET(GNUTLS_FIND_QUIETLY TRUE)
ENDIF()
# Save default suffixes
SET(_OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
# Define specific suffixes
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX})
FIND_PATH(GNUTLS_INCLUDE_DIR
gnutls.h
PATHS
$ENV{GNUTLS_DIR}/include
/usr/local/include
/usr/include/gnutls
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES gnutls
)
FIND_LIBRARY(GNUTLS_LIBRARY
NAMES gnutls libgnutls
PATHS
$ENV{GNUTLS_DIR}/lib
/usr/local/lib
/usr/lib
/usr/lib/x86_64-linux-gnu/
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
# Restore default suffixes
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${_OLD_SUFFIXES})
IF(GNUTLS_LIBRARY AND GNUTLS_INCLUDE_DIR)
SET(GNUTLS_FOUND "YES")
IF(NOT GNUTLS_FIND_QUIETLY)
MESSAGE(STATUS "Found gnutls: ${GNUTLS_LIBRARY}")
ENDIF()
ELSE()
IF(NOT GNUTLS_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find gnutls!")
ENDIF()
ENDIF()