Module: kamailio Branch: master Commit: 6a666575765373ee3c8d1daeee580bf50e28b1ff URL: https://github.com/kamailio/kamailio/commit/6a666575765373ee3c8d1daeee580bf50e28b1ff
Author: Xenofon Karamanos <[email protected]> Committer: Xenofon Karamanos <[email protected]> Date: 2025-11-07T12:33:00Z gcrypt: cmake: Fallback to libgcrypt-config for older distributions - If no .pc installed, use the libgcrypt-config executable to find the libraries --- Modified: src/modules/gcrypt/CMakeLists.txt --- Diff: https://github.com/kamailio/kamailio/commit/6a666575765373ee3c8d1daeee580bf50e28b1ff.diff Patch: https://github.com/kamailio/kamailio/commit/6a666575765373ee3c8d1daeee580bf50e28b1ff.patch --- diff --git a/src/modules/gcrypt/CMakeLists.txt b/src/modules/gcrypt/CMakeLists.txt index 690e5cf57ae..914808acc07 100644 --- a/src/modules/gcrypt/CMakeLists.txt +++ b/src/modules/gcrypt/CMakeLists.txt @@ -3,7 +3,38 @@ file(GLOB MODULE_SOURCES "*.c") add_library(${module_name} SHARED ${MODULE_SOURCES}) find_package(PkgConfig REQUIRED) -pkg_check_modules(gcrypt REQUIRED IMPORTED_TARGET libgcrypt) -add_library(gcrypt::gcrypt ALIAS PkgConfig::gcrypt) +pkg_check_modules(gcrypt IMPORTED_TARGET libgcrypt) + +# Fallback to libgcrypt-config if pkg-config fails (RHEL8-based systems) +if(NOT gcrypt_FOUND) + message(STATUS "Trying to find libgcrypt-config instead...") + find_program(LIBGCRYPT_CONFIG_EXECUTABLE NAMES libgcrypt-config) + if(NOT LIBGCRYPT_CONFIG_EXECUTABLE) + message(FATAL_ERROR "libgcrypt-config not found. Please install libgcrypt development package.") + endif() + message(STATUS "Trying to find libgcrypt-config... - Found: ${LIBGCRYPT_CONFIG_EXECUTABLE}") + execute_process( + COMMAND ${LIBGCRYPT_CONFIG_EXECUTABLE} --cflags + OUTPUT_VARIABLE LIBGCRYPT_CFLAGS + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + execute_process( + COMMAND ${LIBGCRYPT_CONFIG_EXECUTABLE} --libs + OUTPUT_VARIABLE LIBGCRYPT_LIBS + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + # Create an interface library to hold the compile options and link libraries + # These will contain already the necessary -I and -L flags. + # Might need to remove for non-gcc compatible compilers + add_library(gcrypt_libs INTERFACE) + set_target_properties( + gcrypt_libs PROPERTIES INTERFACE_COMPILE_OPTIONS "${LIBGCRYPT_CFLAGS}" INTERFACE_LINK_LIBRARIES + "${LIBGCRYPT_LIBS}" + ) + add_library(gcrypt::gcrypt ALIAS gcrypt_libs) +else() + add_library(gcrypt::gcrypt ALIAS PkgConfig::gcrypt) +endif() target_link_libraries(${module_name} PRIVATE gcrypt::gcrypt) _______________________________________________ Kamailio - Development Mailing List -- [email protected] To unsubscribe send an email to [email protected] Important: keep the mailing list in the recipients, do not reply only to the sender!
