Fix libtomcrypt detection in CMake

This commit is contained in:
Dmitry Marakasov
2021-12-24 16:10:44 +03:00
parent 24c56b3839
commit 329dcde478

View File

@@ -296,7 +296,12 @@ else()
option(WITH_LIBTOMCRYPT "Use system LibTomCrypt library" OFF)
if(WITH_LIBTOMCRYPT)
set(LINK_LIBS ${LINK_LIBS} tomcrypt)
include(FindPkgConfig)
pkg_check_modules(PC_LIBTOMCRYPT libtomcrypt REQUIRED)
find_path(LIBTOMCRYPT_INCLUDE_DIR NAMES tomcrypt.h HINTS ${PC_LIBTOMCRYPT_INCLUDE_DIRS} REQUIRED)
find_library(LIBTOMCRYPT_LIBRARY NAMES tomcrypt HINTS ${PC_LIBTOMCRYPT_LIBRARY_DIRS} REQUIRED)
set(LINK_LIBS ${LINK_LIBS} ${LIBTOMCRYPT_LIBRARY})
include_directories(${LIBTOMCRYPT_INCLUDE_DIR})
else()
set(SRC_ADDITIONAL_FILES ${TOMCRYPT_FILES} ${TOMMATH_FILES})
endif()