CMake: clean up FindGCRYPT.cmake
Use consistent lowercase capitalization and whitespace. Windows: clarify libgpg-error names and remove libgcc_s (1.7.6/1.8.3 do not need it). Change-Id: I5d1b1a67f7a992ccfca4c28d0e19bbbfc41b7a4d Reviewed-on: https://code.wireshark.org/review/31244 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
parent
54f0159950
commit
932edd0878
|
@ -9,24 +9,28 @@
|
||||||
# GCRYPT_DLLS - (Windows) List of required Libgcrypt DLLs.
|
# GCRYPT_DLLS - (Windows) List of required Libgcrypt DLLs.
|
||||||
|
|
||||||
|
|
||||||
IF (GCRYPT_INCLUDE_DIRS)
|
if(GCRYPT_INCLUDE_DIRS)
|
||||||
# Already in cache, be silent
|
# Already in cache, be silent
|
||||||
SET(GCRYPT_FIND_QUIETLY TRUE)
|
set(GCRYPT_FIND_QUIETLY TRUE)
|
||||||
ENDIF (GCRYPT_INCLUDE_DIRS)
|
endif()
|
||||||
|
|
||||||
INCLUDE(FindWSWinLibs)
|
include(FindWSWinLibs)
|
||||||
FindWSWinLibs("libgcrypt-.*" "GCRYPT_HINTS")
|
FindWSWinLibs("libgcrypt-.*" "GCRYPT_HINTS")
|
||||||
|
|
||||||
FIND_PATH(GCRYPT_INCLUDE_DIR gcrypt.h
|
find_path(GCRYPT_INCLUDE_DIR gcrypt.h
|
||||||
HINTS
|
HINTS
|
||||||
"${GCRYPT_HINTS}"
|
"${GCRYPT_HINTS}/include"
|
||||||
PATH_SUFFIXES
|
|
||||||
include
|
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(GCRYPT_NAMES gcrypt libgcrypt-20)
|
find_library(GCRYPT_LIBRARY
|
||||||
FIND_LIBRARY(GCRYPT_LIBRARY NAMES ${GCRYPT_NAMES} libgcc_s_sjlj-1 HINTS "${GCRYPT_HINTS}/bin")
|
NAMES gcrypt libgcrypt-20
|
||||||
FIND_LIBRARY(GCRYPT_ERROR_LIBRARY NAMES gpg-error libgpg-error-0 libgpg-error6-0 HINTS "${GCRYPT_HINTS}/bin")
|
HINTS "${GCRYPT_HINTS}/bin")
|
||||||
|
|
||||||
|
# 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).
|
||||||
|
find_library(GCRYPT_ERROR_LIBRARY
|
||||||
|
NAMES gpg-error libgpg-error-0 libgpg-error6-0
|
||||||
|
HINTS "${GCRYPT_HINTS}/bin")
|
||||||
|
|
||||||
# Try to retrieve version from header if found (available since libgcrypt 1.3.0)
|
# Try to retrieve version from header if found (available since libgcrypt 1.3.0)
|
||||||
if(GCRYPT_INCLUDE_DIR)
|
if(GCRYPT_INCLUDE_DIR)
|
||||||
|
@ -36,36 +40,33 @@ if(GCRYPT_INCLUDE_DIR)
|
||||||
unset(_version_regex)
|
unset(_version_regex)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set GCRYPT_FOUND to TRUE if
|
include(FindPackageHandleStandardArgs)
|
||||||
# all listed variables are TRUE and the requested version matches.
|
find_package_handle_standard_args(GCRYPT
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GCRYPT
|
|
||||||
REQUIRED_VARS GCRYPT_LIBRARY GCRYPT_INCLUDE_DIR
|
REQUIRED_VARS GCRYPT_LIBRARY GCRYPT_INCLUDE_DIR
|
||||||
VERSION_VAR GCRYPT_VERSION)
|
VERSION_VAR GCRYPT_VERSION)
|
||||||
|
|
||||||
IF(GCRYPT_FOUND)
|
if(GCRYPT_FOUND)
|
||||||
SET( GCRYPT_LIBRARIES ${GCRYPT_LIBRARY} ${GCRYPT_ERROR_LIBRARY})
|
set(GCRYPT_LIBRARIES ${GCRYPT_LIBRARY} ${GCRYPT_ERROR_LIBRARY})
|
||||||
SET( GCRYPT_INCLUDE_DIRS ${GCRYPT_INCLUDE_DIR})
|
set(GCRYPT_INCLUDE_DIRS ${GCRYPT_INCLUDE_DIR})
|
||||||
if (WIN32)
|
if(WIN32)
|
||||||
set ( GCRYPT_DLL_DIR "${GCRYPT_HINTS}/bin"
|
set(GCRYPT_DLL_DIR "${GCRYPT_HINTS}/bin"
|
||||||
CACHE PATH "Path to the Libgcrypt DLLs"
|
CACHE PATH "Path to the Libgcrypt DLLs"
|
||||||
)
|
)
|
||||||
file( GLOB _gcrypt_dlls RELATIVE "${GCRYPT_DLL_DIR}"
|
file(GLOB _gcrypt_dlls RELATIVE "${GCRYPT_DLL_DIR}"
|
||||||
#"${GCRYPT_DLL_DIR}/libgcc_s_*.dll"
|
|
||||||
"${GCRYPT_DLL_DIR}/libgcrypt-*.dll"
|
"${GCRYPT_DLL_DIR}/libgcrypt-*.dll"
|
||||||
"${GCRYPT_DLL_DIR}/libgpg-error*.dll"
|
"${GCRYPT_DLL_DIR}/libgpg-error*.dll"
|
||||||
)
|
)
|
||||||
set ( GCRYPT_DLLS ${_gcrypt_dlls}
|
set(GCRYPT_DLLS ${_gcrypt_dlls}
|
||||||
# We're storing filenames only. Should we use STRING instead?
|
# We're storing filenames only. Should we use STRING instead?
|
||||||
CACHE FILEPATH "Libgcrypt DLL list"
|
CACHE FILEPATH "Libgcrypt DLL list"
|
||||||
)
|
)
|
||||||
mark_as_advanced( GCRYPT_DLL_DIR GCRYPT_DLLS )
|
mark_as_advanced(GCRYPT_DLL_DIR GCRYPT_DLLS)
|
||||||
endif()
|
endif()
|
||||||
ELSE(GCRYPT_FOUND)
|
else()
|
||||||
SET( GCRYPT_LIBRARIES )
|
set(GCRYPT_LIBRARIES)
|
||||||
SET( GCRYPT_INCLUDE_DIRS )
|
set(GCRYPT_INCLUDE_DIRS)
|
||||||
SET( GCRYPT_DLL_DIR )
|
set(GCRYPT_DLL_DIR)
|
||||||
SET( GCRYPT_DLLS )
|
set(GCRYPT_DLLS)
|
||||||
ENDIF(GCRYPT_FOUND)
|
endif()
|
||||||
|
|
||||||
MARK_AS_ADVANCED( GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIRS )
|
mark_as_advanced(GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIRS)
|
||||||
|
|
Loading…
Reference in New Issue