Only look for libjwt-gnutls and look for openssl only if gnutls is not found

This commit is contained in:
hax0kartik 2020-03-03 07:39:29 -08:00
parent cfcaf0fb81
commit ef3d7497d0
2 changed files with 37 additions and 35 deletions

View File

@ -357,9 +357,32 @@ else(LIBJWT_FOUND)
set(optlibsnotfound "${optlibsnotfound} LIBJWT") set(optlibsnotfound "${optlibsnotfound} LIBJWT")
endif(LIBJWT_FOUND) endif(LIBJWT_FOUND)
# gnutls (using find_library and find_path)
find_library(GNUTLS_LIBRARIES gnutls)
if(GNUTLS_LIBRARIES)
set(HAVE_LIBGNUTLS 1)
find_library(GNUTLS_OPENSSL_LIBRARIES gnutls-openssl)
if(GNUTLS_OPENSSL_LIBRARIES)
list(APPEND ZM_BIN_LIBS "${GNUTLS_OPENSSL_LIBRARIES}")
check_include_file("gnutls/openssl.h" HAVE_GNUTLS_OPENSSL_H)
endif(GNUTLS_OPENSSL_LIBRARIES)
list(APPEND ZM_BIN_LIBS "${GNUTLS_LIBRARIES}")
find_path(GNUTLS_INCLUDE_DIR gnutls/gnutls.h)
if(GNUTLS_INCLUDE_DIR)
include_directories("${GNUTLS_INCLUDE_DIR}")
set(CMAKE_REQUIRED_INCLUDES "${GNUTLS_INCLUDE_DIR}")
endif(GNUTLS_INCLUDE_DIR)
mark_as_advanced(FORCE GNUTLS_LIBRARIES GNUTLS_INCLUDE_DIR)
check_include_file("gnutls/gnutls.h" HAVE_GNUTLS_GNUTLS_H)
set(optlibsfound "${optlibsfound} GnuTLS")
else(GNUTLS_LIBRARIES)
set(optlibsnotfound "${optlibsnotfound} GnuTLS")
endif(GNUTLS_LIBRARIES)
# OpenSSL # OpenSSL
find_package(OpenSSL) if(NOT HAVE_LIBGNUTLS)
if(OPENSSL_FOUND) find_package(OpenSSL)
if(OPENSSL_FOUND)
set(HAVE_LIBOPENSSL 1) set(HAVE_LIBOPENSSL 1)
set(HAVE_LIBCRYPTO 1) set(HAVE_LIBCRYPTO 1)
list(APPEND ZM_BIN_LIBS "${OPENSSL_LIBRARIES}") list(APPEND ZM_BIN_LIBS "${OPENSSL_LIBRARIES}")
@ -367,9 +390,10 @@ if(OPENSSL_FOUND)
set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}") set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}")
check_include_file("openssl/md5.h" HAVE_OPENSSL_MD5_H) check_include_file("openssl/md5.h" HAVE_OPENSSL_MD5_H)
set(optlibsfound "${optlibsfound} OpenSSL") set(optlibsfound "${optlibsfound} OpenSSL")
else(OPENSSL_FOUND) else(OPENSSL_FOUND)
set(optlibsnotfound "${optlibsnotfound} OpenSSL") set(optlibsnotfound "${optlibsnotfound} OpenSSL")
endif(OPENSSL_FOUND) endif(OPENSSL_FOUND)
endif(NOT HAVE_LIBGNUTLS)
# pthread (using find_library and find_path) # pthread (using find_library and find_path)
find_library(PTHREAD_LIBRARIES pthread) find_library(PTHREAD_LIBRARIES pthread)
@ -426,28 +450,6 @@ else(GCRYPT_LIBRARIES)
set(optlibsnotfound "${optlibsnotfound} GCrypt") set(optlibsnotfound "${optlibsnotfound} GCrypt")
endif(GCRYPT_LIBRARIES) endif(GCRYPT_LIBRARIES)
# gnutls (using find_library and find_path)
find_library(GNUTLS_LIBRARIES gnutls)
if(GNUTLS_LIBRARIES)
set(HAVE_LIBGNUTLS 1)
find_library(GNUTLS_OPENSSL_LIBRARIES gnutls-openssl)
if(GNUTLS_OPENSSL_LIBRARIES)
list(APPEND ZM_BIN_LIBS "${GNUTLS_OPENSSL_LIBRARIES}")
check_include_file("gnutls/openssl.h" HAVE_GNUTLS_OPENSSL_H)
endif(GNUTLS_OPENSSL_LIBRARIES)
list(APPEND ZM_BIN_LIBS "${GNUTLS_LIBRARIES}")
find_path(GNUTLS_INCLUDE_DIR gnutls/gnutls.h)
if(GNUTLS_INCLUDE_DIR)
include_directories("${GNUTLS_INCLUDE_DIR}")
set(CMAKE_REQUIRED_INCLUDES "${GNUTLS_INCLUDE_DIR}")
endif(GNUTLS_INCLUDE_DIR)
mark_as_advanced(FORCE GNUTLS_LIBRARIES GNUTLS_INCLUDE_DIR)
check_include_file("gnutls/gnutls.h" HAVE_GNUTLS_GNUTLS_H)
set(optlibsfound "${optlibsfound} GnuTLS")
else(GNUTLS_LIBRARIES)
set(optlibsnotfound "${optlibsnotfound} GnuTLS")
endif(GNUTLS_LIBRARIES)
# mysqlclient (using find_library and find_path) # mysqlclient (using find_library and find_path)
find_library(MYSQLCLIENT_LIBRARIES mysqlclient PATH_SUFFIXES mysql) find_library(MYSQLCLIENT_LIBRARIES mysqlclient PATH_SUFFIXES mysql)
if(MYSQLCLIENT_LIBRARIES) if(MYSQLCLIENT_LIBRARIES)

View File

@ -9,7 +9,7 @@ find_path(LIBJWT_INCLUDE_DIR
) )
find_library(LIBJWT_LIBRARY find_library(LIBJWT_LIBRARY
NAMES jwt libjwt liblibjwt jwt-gnutls libjwt-gnutls liblibjjwt-gnutls NAMES jwt-gnutls libjwt-gnutls liblibjwt-gnutls
HINTS ${PC_LIBJWT_LIBDIR} ${PC_LIBJWT_LIBRARY_DIR} HINTS ${PC_LIBJWT_LIBDIR} ${PC_LIBJWT_LIBRARY_DIR}
) )