1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 09:42:10 +02:00

Add FindNettle.cmake for Nettle library

This commit is contained in:
Prasenjit Kumar Shaw 2019-06-26 01:54:34 +05:30
parent ef5a2ab1db
commit 881a060c27
3 changed files with 33 additions and 1 deletions

View File

@ -9,7 +9,7 @@ include(FeatureSummary)
find_package(ECM 5.27.0 CONFIG)
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/frameworks/extra-cmake-modules")
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_SOURCE_DIR})
# Many includes from ECM, to get all the nice cmake functions and settings
include(KDEInstallDirs)
@ -88,6 +88,9 @@ endif()
# Mandatory: OpenSSL
find_package(OpenSSL REQUIRED)
# Mandatory: Nettle
find_package(Nettle REQUIRED)
# Mandatory: KF5
find_package(KF5 REQUIRED COMPONENTS Archive)

27
FindNettle.cmake Normal file
View File

@ -0,0 +1,27 @@
# - Try to find nettle
# Once done this will define
# NETTLE_FOUND - System has nettle
# NETTLE_INCLUDE_DIRS - The nettle include directories
# NETTLE_LIBRARIES - The libraries needed to use nettle
# NETTLE_DEFINITIONS - Compiler switches required for using nettle
find_package(PkgConfig)
pkg_check_modules(PC_NETTLE QUIET nettle)
set(NETTLE_DEFINITIONS ${PC_NETTLE_CFLAGS_OTHER})
find_path(NETTLE_INCLUDE_DIR NAMES nettle/hkdf.h nettle/hmac.h nettle/sha2.h
HINTS ${PC_NETTLE_INCLUDEDIR} ${PC_NETTLE_INCLUDE_DIRS}
PATH_SUFFIXES nettle )
find_library(NETTLE_LIBRARY NAMES nettle libnettle
HINTS ${PC_NETTLE_LIBDIR} ${PC_NETTLE_LIBRARY_DIRS} )
set(NETTLE_LIBRARIES ${NETTLE_LIBRARY} )
set(NETTLE_INCLUDE_DIRS ${NETTLE_INCLUDE_DIR} )
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set NETTLE_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(nettle DEFAULT_MSG
NETTLE_LIBRARY NETTLE_INCLUDE_DIR)
mark_as_advanced(NETTLE_INCLUDE_DIR NETTLE_LIBRARY )

View File

@ -40,6 +40,7 @@ include_directories(
)
include_directories(${OPENSSL_INCLUDE_DIR})
include_directories(${NETTLE_INCLUDE_DIR})
set(SRCS ${SRCS}
3rdparty/fancytabwidget.cpp
@ -357,6 +358,7 @@ target_link_libraries(FalkonPrivate
Qt5::WebChannel
KF5::Archive
${OPENSSL_CRYPTO_LIBRARY}
${NETTLE_LIBRARY}
)
if (UNIX AND NOT APPLE)