CMake: improve finding Gcrypt library

This commit is contained in:
Joakim Karlsson 2022-08-22 17:29:44 +02:00 committed by AndersBroman
parent 90a7d0704b
commit da809de404
1 changed files with 18 additions and 4 deletions

View File

@ -17,23 +17,37 @@ endif()
include(FindWSWinLibs)
FindWSWinLibs("libgcrypt-.*" "GCRYPT_HINTS")
find_path(GCRYPT_INCLUDE_DIR gcrypt.h
find_path(GCRYPT_INCLUDE_DIR
NAMES gcrypt.h
PATH_SUFFIXES
include
HINTS
"${GCRYPT_HINTS}/include"
"${GCRYPT_INCLUDEDIR}"
"${GCRYPT_HINTS}"
)
# libgcrypt-20 is used in libgcrypt-1.8.3-win??ws (from Debian).
# libgcrypt is used in libgcrypt-1.10.1-2-win??ws (from Debian).
find_library(GCRYPT_LIBRARY
NAMES gcrypt libgcrypt libgcrypt-20
HINTS "${GCRYPT_HINTS}/lib")
PATH_SUFFIXES
lib
HINTS
"${GCRYPT_LIBDIR}"
"${GCRYPT_HINTS}"
)
# libgpg-error6-0 is used in libgcrypt-1.7.6-win??ws (built from source).
# libgpg-error-0 is used in libgcrypt-1.8.3-win??ws (from Debian).
# libgpg-error is used in libgcrypt-1.10.1-2-win??ws (from Debian).
find_library(GCRYPT_ERROR_LIBRARY
NAMES gpg-error libgpg-error libgpg-error-0 libgpg-error6-0
HINTS "${GCRYPT_HINTS}/lib")
PATH_SUFFIXES
lib
HINTS
"${GCRYPT_LIBDIR}"
"${GCRYPT_HINTS}"
)
# Try to retrieve version from header if found (available since libgcrypt 1.3.0)
if(GCRYPT_INCLUDE_DIR)