mirror of https://github.com/getdnsapi/getdns.git
Merge branch 'madebr-cmake_pkgconfig' into develop
This commit is contained in:
commit
f97ee14b69
|
@ -686,9 +686,6 @@ if (NOT HAVE_SSL_DANE_ENABLE)
|
|||
target_include_directories(getdns_objects PRIVATE src/ssl_dane)
|
||||
set(USE_DANESSL 1)
|
||||
endif ()
|
||||
if (Libidn_FOUND)
|
||||
target_include_directories(getdns_objects PRIVATE ${LIBIDN_INCLUDE_DIR})
|
||||
endif ()
|
||||
if (Libidn2_FOUND)
|
||||
target_include_directories(getdns_objects PRIVATE ${LIBIDN2_INCLUDE_DIR})
|
||||
endif ()
|
||||
|
@ -722,9 +719,6 @@ if (ENABLE_STATIC)
|
|||
if (Libunbound_FOUND)
|
||||
target_link_libraries(getdns PUBLIC Libunbound::Libunbound)
|
||||
endif ()
|
||||
if (Libidn_FOUND)
|
||||
target_link_libraries(getdns PUBLIC Libidn::Libidn)
|
||||
endif ()
|
||||
if (Libidn2_FOUND)
|
||||
target_link_libraries(getdns PUBLIC Libidn2::Libidn2)
|
||||
endif ()
|
||||
|
@ -754,9 +748,6 @@ if (ENABLE_SHARED)
|
|||
if (Libunbound_FOUND)
|
||||
target_link_libraries(getdns_shared PUBLIC Libunbound::Libunbound)
|
||||
endif ()
|
||||
if (Libidn_FOUND)
|
||||
target_link_libraries(getdns_shared PUBLIC Libidn::Libidn)
|
||||
endif ()
|
||||
if (Libidn2_FOUND)
|
||||
target_link_libraries(getdns_shared PUBLIC Libidn2::Libidn2)
|
||||
endif ()
|
||||
|
|
|
@ -28,71 +28,87 @@ This module will set the following variables in your project:
|
|||
|
||||
#]=======================================================================]
|
||||
|
||||
find_path(CHECK_INCLUDE_DIR check.h
|
||||
HINTS
|
||||
"${CHECK_DIR}"
|
||||
"${CHECK_DIR}/include"
|
||||
)
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PkgCheck IMPORTED_TARGET GLOBAL check)
|
||||
endif ()
|
||||
|
||||
# Check for PIC and non-PIC libraries. If PIC present, use that
|
||||
# in preference (as per Debian check.pc).
|
||||
find_library(CHECK_LIBRARY NAMES check_pic libcheck_pic
|
||||
HINTS
|
||||
"${CHECK_DIR}"
|
||||
"${CHECK_DIR}/lib"
|
||||
)
|
||||
if (PkgCheck_FOUND)
|
||||
set(CHECK_INCLUDE_DIR ${PkgCheck_INCLUDE_DIRS} CACHE FILEPATH "check include path")
|
||||
set(CHECK_LIBRARIES ${PkgCheck_LIBRARIES} CACHE STRING "check libraries")
|
||||
set(CHECK_VERSION ${PkgCheck_VERSION})
|
||||
add_library(Check::Check ALIAS PkgConfig::PkgCheck)
|
||||
set(Check_FOUND ON)
|
||||
else ()
|
||||
find_path(CHECK_INCLUDE_DIR check.h
|
||||
HINTS
|
||||
"${CHECK_DIR}"
|
||||
"${CHECK_DIR}/include"
|
||||
)
|
||||
|
||||
if (NOT CHECK_LIBRARY)
|
||||
find_library(CHECK_LIBRARY NAMES check libcheck
|
||||
# Check for PIC and non-PIC libraries. If PIC present, use that
|
||||
# in preference (as per Debian check.pc).
|
||||
find_library(CHECK_LIBRARY NAMES check_pic libcheck_pic
|
||||
HINTS
|
||||
"${CHECK_DIR}"
|
||||
"${CHECK_DIR}/lib"
|
||||
)
|
||||
endif ()
|
||||
|
||||
set(CHECK_LIBRARIES "")
|
||||
|
||||
# Check may need the math, subunit and rt libraries on Unix
|
||||
if (UNIX)
|
||||
find_library(CHECK_MATH_LIBRARY m)
|
||||
find_library(CHECK_RT_LIBRARY rt)
|
||||
find_library(CHECK_SUBUNIT_LIBRARY subunit)
|
||||
|
||||
if (CHECK_MATH_LIBRARY)
|
||||
list(APPEND CHECK_LIBRARIES "${CHECK_MATH_LIBRARY}")
|
||||
endif ()
|
||||
if (CHECK_RT_LIBRARY)
|
||||
list(APPEND CHECK_LIBRARIES "${CHECK_RT_LIBRARY}")
|
||||
endif ()
|
||||
if (CHECK_SUBUNIT_LIBRARY)
|
||||
list(APPEND CHECK_LIBRARIES "${CHECK_SUBUNIT_LIBRARY}")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
if (CHECK_INCLUDE_DIR AND CHECK_LIBRARY)
|
||||
if (NOT TARGET Check::Check)
|
||||
add_library(Check::Check UNKNOWN IMPORTED)
|
||||
set_target_properties(Check::Check PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CHECK_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "${CHECK_LIBRARIES}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${CHECK_LIBRARY}"
|
||||
if (NOT CHECK_LIBRARY)
|
||||
find_library(CHECK_LIBRARY NAMES check libcheck
|
||||
HINTS
|
||||
"${CHECK_DIR}"
|
||||
"${CHECK_DIR}/lib"
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (NOT CHECK_VERSION AND CHECK_INCLUDE_DIR AND EXISTS "${CHECK_INCLUDE_DIR}/check.h")
|
||||
file(STRINGS "${CHECK_INCLUDE_DIR}/check.h" CHECK_H REGEX "^#define CHECK_M[A-Z]+_VERSION")
|
||||
string(REGEX REPLACE "^.*\(([0-9]+)\).*\(([0-9]+)\).*\(([0-9]+)\).*$" "\\1.\\2.\\3" CHECK_VERSION "${CHECK_H}")
|
||||
endif ()
|
||||
set(_CHECK_LIBARIES "")
|
||||
|
||||
# Check may need the math, subunit and rt libraries on Unix
|
||||
if (UNIX)
|
||||
find_library(CHECK_MATH_LIBRARY m)
|
||||
find_library(CHECK_RT_LIBRARY rt)
|
||||
find_library(CHECK_SUBUNIT_LIBRARY subunit)
|
||||
|
||||
if (CHECK_MATH_LIBRARY)
|
||||
list(APPEND _CHECK_LIBARIES "${CHECK_MATH_LIBRARY}")
|
||||
endif ()
|
||||
if (CHECK_RT_LIBRARY)
|
||||
list(APPEND _CHECK_LIBARIES "${CHECK_RT_LIBRARY}")
|
||||
endif ()
|
||||
if (CHECK_SUBUNIT_LIBRARY)
|
||||
list(APPEND _CHECK_LIBARIES "${CHECK_SUBUNIT_LIBRARY}")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
set(CHECK_LIBRARIES ${_CHECK_LIBARIES} ${CHECK_LIBRARY} CACHE STRING "check libraries")
|
||||
|
||||
if (CHECK_INCLUDE_DIR AND CHECK_LIBRARY)
|
||||
if (NOT TARGET Check::Check)
|
||||
add_library(Check::Check UNKNOWN IMPORTED)
|
||||
set_target_properties(Check::Check PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CHECK_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "${CHECK_LIBRARIES}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${CHECK_LIBRARY}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (NOT CHECK_VERSION AND CHECK_INCLUDE_DIR AND EXISTS "${CHECK_INCLUDE_DIR}/check.h")
|
||||
file(STRINGS "${CHECK_INCLUDE_DIR}/check.h" CHECK_H REGEX "^#define CHECK_M[A-Z]+_VERSION")
|
||||
string(REGEX REPLACE "^.*\(([0-9]+)\).*\(([0-9]+)\).*\(([0-9]+)\).*$" "\\1.\\2.\\3" CHECK_VERSION "${CHECK_H}")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
list(APPEND CHECK_LIBRARIES "${CHECK_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Check
|
||||
REQUIRED_VARS CHECK_LIBRARIES CHECK_INCLUDE_DIR
|
||||
VERSION_VAR CHECK_VERSION
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
list(APPEND CHECK_LIBRARIES "${CHECK_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Check
|
||||
REQUIRED_VARS CHECK_LIBRARIES CHECK_INCLUDE_DIR
|
||||
VERSION_VAR CHECK_VERSION
|
||||
)
|
||||
|
||||
mark_as_advanced(CHECK_INCLUDE_DIR CHECK_LIBRARIES CHECK_LIBRARY
|
||||
CHECK_MATH_LIBRARY CHECK_RT_LIBRARY CHECK_SUBUNIT_LIBRARY)
|
||||
|
|
|
@ -30,56 +30,72 @@ This module will set the following variables in your project:
|
|||
|
||||
#]=======================================================================]
|
||||
|
||||
find_path(GNUTLS_INCLUDE_DIR gnutls/gnutls.h
|
||||
HINTS
|
||||
"${GNUTLS_DIR}"
|
||||
"${GNUTLS_DIR}/include"
|
||||
)
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PkgGnuTLS IMPORTED_TARGET GLOBAL QUIET gnutls)
|
||||
pkg_check_modules(PkgGnuTLSDane IMPORTED_TARGET GLOBAL QUIET gnutls-dane)
|
||||
endif ()
|
||||
|
||||
find_library(GNUTLS_LIBRARY NAMES gnutls libgnutls
|
||||
HINTS
|
||||
"${GNUTLS_DIR}"
|
||||
"${GNUTLS_DIR}/lib"
|
||||
)
|
||||
|
||||
find_library(GNUTLS_DANE_LIBRARY NAMES gnutls-dane libgnutls-dane
|
||||
HINTS
|
||||
"${GNUTLS_DIR}"
|
||||
"${GNUTLS_DIR}/lib"
|
||||
)
|
||||
|
||||
set(GNUTLS_LIBRARIES "")
|
||||
|
||||
if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY AND GNUTLS_DANE_LIBRARY)
|
||||
if (NOT TARGET GnuTLS::GnuTLS)
|
||||
add_library(GnuTLS::GnuTLS UNKNOWN IMPORTED)
|
||||
set_target_properties(GnuTLS::GnuTLS PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${GNUTLS_INCLUDE_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${GNUTLS_LIBRARY}"
|
||||
)
|
||||
endif ()
|
||||
if (NOT TARGET GnuTLS::Dane)
|
||||
add_library(GnuTLS::Dane UNKNOWN IMPORTED)
|
||||
set_target_properties(GnuTLS::Dane PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${GNUTLS_INCLUDE_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${GNUTLS_DANE_LIBRARY}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (NOT GNUTLS_VERSION AND GNUTLS_INCLUDE_DIR)
|
||||
file(STRINGS "${GNUTLS_INCLUDE_DIR}/gnutls/gnutls.h" GNUTLS_VER_H REGEX "^#define GNUTLS_VERSION_(MAJOR|MINOR|PATCH) ")
|
||||
string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*_PATCH ([0-9]+).*$" "\\1.\\2.\\3c" GNUTLS_VERSION "${GNUTLS_VER_H}")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
list(APPEND GNUTLS_LIBRARIES "${GNUTLS_LIBRARY}" "${GNUTLS_DANE_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GnuTLS
|
||||
REQUIRED_VARS GNUTLS_LIBRARIES GNUTLS_INCLUDE_DIR
|
||||
VERSION_VAR GNUTLS_VERSION
|
||||
if (PkgGnuTLS_FOUND AND PkgGnuTLSDane_FOUND)
|
||||
set(GNUTLS_INCLUDE_DIR ${PkgGnuTLS_INCLUDE_DIRS} $PkgGnuTLSDane_INCLUDE_DIRS} CACHE FILEPATH "GnuTLS include path")
|
||||
set(NETTLE_LIBRARIES ${PkgGnuTLS_LIBRARIES} ${PkgGnuTLSDane_LIBRARIES} CACHE STRING "GnuTLS libraries")
|
||||
set(NETTLE_VERSION ${PkgGnuTLS_VERSION})
|
||||
add_library(GnuTLS::GnuTLS ALIAS PkgConfig::PkgGnuTLS)
|
||||
add_library(GnuTLS::Dane ALIAS PkgConfig::PkgGnuTLSDane)
|
||||
set(GnuTLS_FOUND ON)
|
||||
else ()
|
||||
find_path(GNUTLS_INCLUDE_DIR gnutls/gnutls.h
|
||||
HINTS
|
||||
"${GNUTLS_DIR}"
|
||||
"${GNUTLS_DIR}/include"
|
||||
)
|
||||
|
||||
find_library(GNUTLS_LIBRARY NAMES gnutls libgnutls
|
||||
HINTS
|
||||
"${GNUTLS_DIR}"
|
||||
"${GNUTLS_DIR}/lib"
|
||||
)
|
||||
|
||||
find_library(GNUTLS_DANE_LIBRARY NAMES gnutls-dane libgnutls-dane
|
||||
HINTS
|
||||
"${GNUTLS_DIR}"
|
||||
"${GNUTLS_DIR}/lib"
|
||||
)
|
||||
|
||||
set(_GNUTLS_LIBRARIES "")
|
||||
|
||||
if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY AND GNUTLS_DANE_LIBRARY)
|
||||
if (NOT TARGET GnuTLS::GnuTLS)
|
||||
add_library(GnuTLS::GnuTLS UNKNOWN IMPORTED)
|
||||
set_target_properties(GnuTLS::GnuTLS PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${GNUTLS_INCLUDE_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${GNUTLS_LIBRARY}"
|
||||
)
|
||||
endif ()
|
||||
if (NOT TARGET GnuTLS::Dane)
|
||||
add_library(GnuTLS::Dane UNKNOWN IMPORTED)
|
||||
set_target_properties(GnuTLS::Dane PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${GNUTLS_INCLUDE_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${GNUTLS_DANE_LIBRARY}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (NOT GNUTLS_VERSION AND GNUTLS_INCLUDE_DIR)
|
||||
file(STRINGS "${GNUTLS_INCLUDE_DIR}/gnutls/gnutls.h" GNUTLS_VER_H REGEX "^#define GNUTLS_VERSION_(MAJOR|MINOR|PATCH) ")
|
||||
string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*_PATCH ([0-9]+).*$" "\\1.\\2.\\3c" GNUTLS_VERSION "${GNUTLS_VER_H}")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
list(APPEND _GNUTLS_LIBRARIES "${GNUTLS_LIBRARY}" "${GNUTLS_DANE_LIBRARY}")
|
||||
set(GNUTLS_LIBRARIES ${_GNUTLS_LIBRARIES} CACHE STRING "GnuTLS libraries")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GnuTLS
|
||||
REQUIRED_VARS GNUTLS_LIBRARIES GNUTLS_INCLUDE_DIR
|
||||
VERSION_VAR GNUTLS_VERSION
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARIES GNUTLS_LIBRARY GNUTLS_DANE_LIBRARY)
|
||||
|
|
|
@ -28,42 +28,51 @@ This module will set the following variables in your project:
|
|||
|
||||
#]=======================================================================]
|
||||
|
||||
find_path(LIBEVENT2_INCLUDE_DIR event2/event.h
|
||||
HINTS
|
||||
"${LIBEVENT2_DIR}"
|
||||
"${LIBEVENT2_DIR}/include"
|
||||
)
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PkgLibevent IMPORTED_TARGET GLOBAL QUIET libevent>=2)
|
||||
endif ()
|
||||
|
||||
find_library(LIBEVENT2_LIBRARY NAMES event_core libevent_core
|
||||
HINTS
|
||||
"${LIBEVENT2_DIR}"
|
||||
"${LIBEVENT2_DIR}/lib"
|
||||
)
|
||||
|
||||
set(LIBEVENT2_LIBRARIES "")
|
||||
|
||||
if (LIBEVENT2_INCLUDE_DIR AND LIBEVENT2_LIBRARY)
|
||||
if (NOT TARGET Libevent2::Libevent_core)
|
||||
add_library(Libevent2::Libevent_core UNKNOWN IMPORTED)
|
||||
set_target_properties(Libevent2::Libevent_core PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LIBEVENT2_INCLUDE_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${LIBEVENT2_LIBRARY}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (NOT LIBEVENT2_VERSION AND LIBEVENT2_INCLUDE_DIR AND EXISTS "${LIBEVENT2_INCLUDE_DIR}/event2/event.h")
|
||||
file(STRINGS "${LIBEVENT2_INCLUDE_DIR}/event2/event-config.h" LIBEVENT2_H REGEX "^#define _?EVENT_+VERSION ")
|
||||
string(REGEX REPLACE "^.*EVENT_+VERSION \"([^\"]+)\".*$" "\\1" LIBEVENT2_VERSION "${LIBEVENT2_H}")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
list(APPEND LIBEVENT2_LIBRARIES "${LIBEVENT2_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libevent2
|
||||
REQUIRED_VARS LIBEVENT2_LIBRARIES LIBEVENT2_INCLUDE_DIR
|
||||
VERSION_VAR LIBEVENT2_VERSION
|
||||
if (PkgLibevent_FOUND)
|
||||
set(LIBEVENT2_INCLUDE_DIR ${PkgLibevent_INCLUDE_DIRS} CACHE FILEPATH "libevent2 include path")
|
||||
set(LIBEVENT2_LIBRARIES ${PkgLibevent_LIBRARIES} CACHE STRING "libevent2 libraries")
|
||||
set(LIBEVENT2_VERSION ${PkgLibevent_VERSION})
|
||||
add_library(Libevent2::Libevent_core ALIAS PkgConfig::PkgLibevent)
|
||||
set(Libevent2_FOUND ON)
|
||||
else ()
|
||||
find_path(LIBEVENT2_INCLUDE_DIR event2/event.h
|
||||
HINTS
|
||||
"${LIBEVENT2_DIR}"
|
||||
"${LIBEVENT2_DIR}/include"
|
||||
)
|
||||
|
||||
find_library(LIBEVENT2_LIBRARIES NAMES event_core libevent_core
|
||||
HINTS
|
||||
"${LIBEVENT2_DIR}"
|
||||
"${LIBEVENT2_DIR}/lib"
|
||||
)
|
||||
|
||||
if (LIBEVENT2_INCLUDE_DIR AND LIBEVENT2_LIBRARIES)
|
||||
if (NOT TARGET Libevent2::Libevent_core)
|
||||
add_library(Libevent2::Libevent_core UNKNOWN IMPORTED)
|
||||
set_target_properties(Libevent2::Libevent_core PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LIBEVENT2_INCLUDE_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${LIBEVENT2_LIBRARIES}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (NOT LIBEVENT2_VERSION AND LIBEVENT2_INCLUDE_DIR AND EXISTS "${LIBEVENT2_INCLUDE_DIR}/event2/event.h")
|
||||
file(STRINGS "${LIBEVENT2_INCLUDE_DIR}/event2/event-config.h" LIBEVENT2_H REGEX "^#define _?EVENT_+VERSION ")
|
||||
string(REGEX REPLACE "^.*EVENT_+VERSION \"([^\"]+)\".*$" "\\1" LIBEVENT2_VERSION "${LIBEVENT2_H}")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(LIBEVENT2_INCLUDE_DIR LIBEVENT2_LIBRARIES LIBEVENT2_LIBRARY)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libevent2
|
||||
REQUIRED_VARS LIBEVENT2_LIBRARIES LIBEVENT2_INCLUDE_DIR
|
||||
VERSION_VAR LIBEVENT2_VERSION
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(LIBEVENT2_INCLUDE_DIR LIBEVENT2_LIBRARIES)
|
||||
|
|
|
@ -28,42 +28,50 @@ This module will set the following variables in your project:
|
|||
|
||||
#]=======================================================================]
|
||||
|
||||
find_path(LIBIDN2_INCLUDE_DIR idn2.h
|
||||
HINTS
|
||||
"${LIBIDN2_DIR}"
|
||||
"${LIBIDN2_DIR}/include"
|
||||
)
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PkgLibIdn2 IMPORTED_TARGET GLOBAL libidn2)
|
||||
endif ()
|
||||
|
||||
find_library(LIBIDN2_LIBRARY NAMES idn2 libidn2
|
||||
HINTS
|
||||
"${LIBIDN2_DIR}"
|
||||
"${LIBIDN2_DIR}/lib"
|
||||
)
|
||||
|
||||
set(LIBIDN2_LIBRARIES "")
|
||||
|
||||
if (LIBIDN2_INCLUDE_DIR AND LIBIDN2_LIBRARY)
|
||||
if (NOT TARGET Libidn2::Libidn2)
|
||||
add_library(Libidn2::Libidn2 UNKNOWN IMPORTED)
|
||||
set_target_properties(Libidn2::Libidn2 PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LIBIDN2_INCLUDE_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${LIBIDN2_LIBRARY}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (NOT LIBIDN2_VERSION AND LIBIDN2_INCLUDE_DIR AND EXISTS "${LIBIDN2_INCLUDE_DIR}/idn2.h")
|
||||
file(STRINGS "${LIBIDN2_INCLUDE_DIR}/idn2.h" LIBIDN2_H REGEX "^[ \t]*#[ \t]*define[ \t]+IDN2_VERSION[ \t]")
|
||||
string(REGEX REPLACE "^.*IDN2_VERSION[ \t]+\"([0-9.]+)\".*$" "\\1" LIBIDN2_VERSION "${LIBIDN2_H}")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
list(APPEND LIBIDN2_LIBRARIES "${LIBIDN2_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libidn2
|
||||
REQUIRED_VARS LIBIDN2_LIBRARIES LIBIDN2_INCLUDE_DIR
|
||||
VERSION_VAR LIBIDN2_VERSION
|
||||
if (PkgLibIdn2_FOUND)
|
||||
set(LIBIDN2_INCLUDE_DIR ${PkgLibIdn2_INCLUDE_DIRS} CACHE FILEPATH "libidn2 include path")
|
||||
set(LIBIDN2_LIBRARIES ${PkgLibIdn2_LIBRARIES} CACHE STRING "libidn2 libraries")
|
||||
set(LIBIDN2_VERSION ${PkgLibIdn2_VERSION})
|
||||
add_library(Libidn2::Libidn2 ALIAS PkgConfig::PkgLibIdn2)
|
||||
set(Libidn2_FOUND ON)
|
||||
else ()
|
||||
find_path(LIBIDN2_INCLUDE_DIR idn2.h
|
||||
HINTS
|
||||
"${LIBIDN2_DIR}"
|
||||
"${LIBIDN2_DIR}/include"
|
||||
)
|
||||
|
||||
mark_as_advanced(LIBIDN2_INCLUDE_DIR LIBIDN2_LIBRARIES LIBIDN2_LIBRARY)
|
||||
find_library(LIBIDN2_LIBRARIES NAMES idn2 libidn2
|
||||
HINTS
|
||||
"${LIBIDN2_DIR}"
|
||||
"${LIBIDN2_DIR}/lib"
|
||||
)
|
||||
|
||||
if (LIBIDN2_INCLUDE_DIR AND LIBIDN2_LIBRARIES)
|
||||
if (NOT TARGET Libidn2::Libidn2)
|
||||
add_library(Libidn2::Libidn2 UNKNOWN IMPORTED)
|
||||
set_target_properties(Libidn2::Libidn2 PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LIBIDN2_INCLUDE_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${LIBIDN2_LIBRARIES}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (NOT LIBIDN2_VERSION AND LIBIDN2_INCLUDE_DIR AND EXISTS "${LIBIDN2_INCLUDE_DIR}/idn2.h")
|
||||
file(STRINGS "${LIBIDN2_INCLUDE_DIR}/idn2.h" LIBIDN2_H REGEX "^[ \t]*#[ \t]*define[ \t]+IDN2_VERSION[ \t]")
|
||||
string(REGEX REPLACE "^.*IDN2_VERSION[ \t]+\"([0-9.]+)\".*$" "\\1" LIBIDN2_VERSION "${LIBIDN2_H}")
|
||||
endif ()
|
||||
endif ()
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libidn2
|
||||
REQUIRED_VARS LIBIDN2_LIBRARIES LIBIDN2_INCLUDE_DIR
|
||||
VERSION_VAR LIBIDN2_VERSION
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(LIBIDN2_INCLUDE_DIR LIBIDN2_LIBRARIES)
|
||||
|
|
|
@ -28,63 +28,77 @@ This module will set the following variables in your project:
|
|||
|
||||
#]=======================================================================]
|
||||
|
||||
find_path(LIBUNBOUND_INCLUDE_DIR unbound.h
|
||||
HINTS
|
||||
"${LIBUNBOUND_DIR}"
|
||||
"${LIBUNBOUND_DIR}/include"
|
||||
)
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PkgLibunbound IMPORTED_TARGET GLOBAL QUIET libunbound)
|
||||
endif ()
|
||||
|
||||
find_library(LIBUNBOUND_LIBRARY NAMES unbound
|
||||
HINTS
|
||||
"${LIBUNBOUND_DIR}"
|
||||
"${LIBUNBOUND_DIR}/lib"
|
||||
)
|
||||
|
||||
set(LIBUNBOUND_LIBRARIES "")
|
||||
|
||||
if (UNIX)
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
list(APPEND LIBUNBOUND_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
|
||||
list(APPEND LIBUNBOUND_LIBRARIES "${OPENSSL_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
if (LIBUNBOUND_INCLUDE_DIR AND LIBUNBOUND_LIBRARY)
|
||||
if (NOT TARGET Libunbound::Libunbound)
|
||||
add_library(Libunbound::Libunbound UNKNOWN IMPORTED)
|
||||
set_target_properties(Libunbound::Libunbound PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LIBUNBOUND_INCLUDE_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${LIBUNBOUND_LIBRARY}"
|
||||
)
|
||||
|
||||
if(UNIX AND TARGET Threads::Threads)
|
||||
set_property(TARGET Libunbound::Libunbound APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES Threads::Threads)
|
||||
endif ()
|
||||
if(UNIX AND TARGET OpenSSL::SSL)
|
||||
set_property(TARGET Libunbound::Libunbound APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES OpenSSL::SSL)
|
||||
endif ()
|
||||
if(UNIX AND TARGET OpenSSL::Crypto)
|
||||
set_property(TARGET Libunbound::Libunbound APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES OpenSSL::Crypto)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT LIBUNBOUND_VERSION AND LIBUNBOUND_INCLUDE_DIR AND EXISTS "${LIBUNBOUND_INCLUDE_DIR}/unbound.h")
|
||||
file(STRINGS "${LIBUNBOUND_INCLUDE_DIR}/unbound.h" LIBUNBOUND_H REGEX "^#define UNBOUND_VERSION_M[A-Z]+")
|
||||
string(REGEX REPLACE "^.*MAJOR ([0-9]+).*MINOR ([0-9]+).*MICRO ([0-9]+).*$" "\\1.\\2.\\3" LIBUNBOUND_VERSION "${LIBUNBOUND_H}")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
list(APPEND LIBUNBOUND_LIBRARIES "${LIBUNBOUND_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libunbound
|
||||
REQUIRED_VARS LIBUNBOUND_LIBRARIES LIBUNBOUND_INCLUDE_DIR
|
||||
VERSION_VAR LIBUNBOUND_VERSION
|
||||
if (PkgLibunbound_FOUND)
|
||||
set(LIBUNBOUND_INCLUDE_DIR ${PkgLibunbound_INCLUDE_DIRS} CACHE FILEPATH "libunbound include path")
|
||||
set(LIBUNBOUND_LIBRARIES ${PkgLibunbound_LIBRARIES} CACHE STRING "libunbound libraries")
|
||||
set(LIBUNBOUND_VERSION ${PkgLibunbound_VERSION})
|
||||
add_library(Libunbound::Libunbound ALIAS PkgConfig::PkgLibunbound)
|
||||
set(Libunbound_FOUND ON)
|
||||
else ()
|
||||
find_path(LIBUNBOUND_INCLUDE_DIR unbound.h
|
||||
HINTS
|
||||
"${LIBUNBOUND_DIR}"
|
||||
"${LIBUNBOUND_DIR}/include"
|
||||
)
|
||||
|
||||
find_library(LIBUNBOUND_LIBRARY NAMES unbound
|
||||
HINTS
|
||||
"${LIBUNBOUND_DIR}"
|
||||
"${LIBUNBOUND_DIR}/lib"
|
||||
)
|
||||
|
||||
set(_LIBUNBOUND_LIBRARIES "")
|
||||
|
||||
if (UNIX)
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
list(APPEND _LIBUNBOUND_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
|
||||
list(APPEND _LIBUNBOUND_LIBRARIES "${OPENSSL_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
if (LIBUNBOUND_INCLUDE_DIR AND LIBUNBOUND_LIBRARY)
|
||||
if (NOT TARGET Libunbound::Libunbound)
|
||||
add_library(Libunbound::Libunbound UNKNOWN IMPORTED)
|
||||
set_target_properties(Libunbound::Libunbound PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LIBUNBOUND_INCLUDE_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${LIBUNBOUND_LIBRARY}"
|
||||
)
|
||||
|
||||
if(UNIX AND TARGET Threads::Threads)
|
||||
set_property(TARGET Libunbound::Libunbound APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES Threads::Threads)
|
||||
endif ()
|
||||
if(UNIX AND TARGET OpenSSL::SSL)
|
||||
set_property(TARGET Libunbound::Libunbound APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES OpenSSL::SSL)
|
||||
endif ()
|
||||
if(UNIX AND TARGET OpenSSL::Crypto)
|
||||
set_property(TARGET Libunbound::Libunbound APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES OpenSSL::Crypto)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT LIBUNBOUND_VERSION AND LIBUNBOUND_INCLUDE_DIR AND EXISTS "${LIBUNBOUND_INCLUDE_DIR}/unbound.h")
|
||||
file(STRINGS "${LIBUNBOUND_INCLUDE_DIR}/unbound.h" LIBUNBOUND_H REGEX "^#define UNBOUND_VERSION_M[A-Z]+")
|
||||
string(REGEX REPLACE "^.*MAJOR ([0-9]+).*MINOR ([0-9]+).*MICRO ([0-9]+).*$" "\\1.\\2.\\3" LIBUNBOUND_VERSION "${LIBUNBOUND_H}")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
list(APPEND _LIBUNBOUND_LIBRARIES "${LIBUNBOUND_LIBRARY}")
|
||||
set(LIBUNBOUND_LIBRARIES ${_LIBUNBOUND_LIBRARIES} CACHE STRING "libunbound libraries")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libunbound
|
||||
REQUIRED_VARS LIBUNBOUND_LIBRARIES LIBUNBOUND_INCLUDE_DIR
|
||||
VERSION_VAR LIBUNBOUND_VERSION
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(LIBUNBOUND_INCLUDE_DIR LIBUNBOUND_LIBRARIES LIBUNBOUND_LIBRARY)
|
||||
|
|
|
@ -28,46 +28,55 @@ This module will set the following variables in your project:
|
|||
|
||||
#]=======================================================================]
|
||||
|
||||
find_path(LIBUV_INCLUDE_DIR uv.h
|
||||
HINTS
|
||||
"${LIBUV_DIR}"
|
||||
"${LIBUV_DIR}/include"
|
||||
)
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PkgLibuv IMPORTED_TARGET GLOBAL libuv)
|
||||
endif ()
|
||||
|
||||
find_library(LIBUV_LIBRARY NAMES uv libuv
|
||||
HINTS
|
||||
"${LIBUV_DIR}"
|
||||
"${LIBUV_DIR}/lib"
|
||||
)
|
||||
|
||||
set(LIBUV_LIBRARIES "")
|
||||
|
||||
if (LIBUV_INCLUDE_DIR AND LIBUV_LIBRARY)
|
||||
if (NOT TARGET Libuv::Libuv)
|
||||
add_library(Libuv::Libuv UNKNOWN IMPORTED)
|
||||
set_target_properties(Libuv::Libuv PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LIBUV_INCLUDE_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${LIBUV_LIBRARY}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (NOT LIBUV_VERSION AND LIBUV_INCLUDE_DIR)
|
||||
if (EXISTS "${LIBUV_INCLUDE_DIR}/uv-version.h")
|
||||
file(STRINGS "${LIBUV_INCLUDE_DIR}/uv-version.h" LIBUV_VER_H REGEX "^#define UV_VERSION_(MAJOR|MINOR|PATCH) ")
|
||||
elseif (EXISTS "${LIBUV_INCLUDE_DIR}/uv/version.h")
|
||||
file(STRINGS "${LIBUV_INCLUDE_DIR}/uv/version.h" LIBUV_VER_H REGEX "^#define UV_VERSION_(MAJOR|MINOR|PATCH) ")
|
||||
endif ()
|
||||
string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*_PATCH ([0-9]+).*$" "\\1.\\2.\\3" LIBUV_VERSION "${LIBUV_VER_H}")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
list(APPEND LIBUV_LIBRARIES "${LIBUV_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libuv
|
||||
REQUIRED_VARS LIBUV_LIBRARIES LIBUV_INCLUDE_DIR
|
||||
VERSION_VAR LIBUV_VERSION
|
||||
if (PkgLibuv_FOUND)
|
||||
set(LIBUV_INCLUDE_DIR ${PkgLibuv_INCLUDE_DIRS} CACHE FILEPATH "libuv include path")
|
||||
set(LIBUV_LIBRARIES ${PkgLibuv_LIBRARIES} CACHE STRING "libuv libraries")
|
||||
set(LIBUV_VERSION ${PkgLibuv_VERSION})
|
||||
add_library(Libuv::Libuv ALIAS PkgConfig::PkgLibuv)
|
||||
set(Libuv_FOUND ON)
|
||||
else ()
|
||||
find_path(LIBUV_INCLUDE_DIR uv.h
|
||||
HINTS
|
||||
"${LIBUV_DIR}"
|
||||
"${LIBUV_DIR}/include"
|
||||
)
|
||||
|
||||
find_library(LIBUV_LIBRARIES NAMES uv libuv
|
||||
HINTS
|
||||
"${LIBUV_DIR}"
|
||||
"${LIBUV_DIR}/lib"
|
||||
)
|
||||
|
||||
if (LIBUV_INCLUDE_DIR AND LIBUV_LIBRARY)
|
||||
if (NOT TARGET Libuv::Libuv)
|
||||
add_library(Libuv::Libuv UNKNOWN IMPORTED)
|
||||
set_target_properties(Libuv::Libuv PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LIBUV_INCLUDE_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${LIBUV_LIBRARIES}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (NOT LIBUV_VERSION AND LIBUV_INCLUDE_DIR)
|
||||
if (EXISTS "${LIBUV_INCLUDE_DIR}/uv-version.h")
|
||||
file(STRINGS "${LIBUV_INCLUDE_DIR}/uv-version.h" LIBUV_VER_H REGEX "^#define UV_VERSION_(MAJOR|MINOR|PATCH) ")
|
||||
elseif (EXISTS "${LIBUV_INCLUDE_DIR}/uv/version.h")
|
||||
file(STRINGS "${LIBUV_INCLUDE_DIR}/uv/version.h" LIBUV_VER_H REGEX "^#define UV_VERSION_(MAJOR|MINOR|PATCH) ")
|
||||
endif ()
|
||||
string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*_PATCH ([0-9]+).*$" "\\1.\\2.\\3" LIBUV_VERSION "${LIBUV_VER_H}")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARIES LIBUV_LIBRARY)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libuv
|
||||
REQUIRED_VARS LIBUV_LIBRARIES LIBUV_INCLUDE_DIR
|
||||
VERSION_VAR LIBUV_VERSION
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARIES)
|
||||
|
|
|
@ -30,66 +30,82 @@ This module will set the following variables in your project:
|
|||
|
||||
#]=======================================================================]
|
||||
|
||||
find_path(NETTLE_INCLUDE_DIR nettle/version.h
|
||||
HINTS
|
||||
"${NETTLE_DIR}"
|
||||
"${NETTLE_DIR}/include"
|
||||
)
|
||||
|
||||
find_library(NETTLE_LIBRARY NAMES nettle libnettle
|
||||
HINTS
|
||||
"${NETTLE_DIR}"
|
||||
"${NETTLE_DIR}/lib"
|
||||
)
|
||||
|
||||
find_library(HOGWEED_LIBRARY NAMES hogweed libhogweed
|
||||
HINTS
|
||||
"${NETTLE_DIR}"
|
||||
"${NETTLE_DIR}/lib"
|
||||
)
|
||||
|
||||
set(NETTLE_LIBRARIES "")
|
||||
|
||||
# May need gmp library on Unix.
|
||||
if (UNIX)
|
||||
find_library(NETTLE_GMP_LIBRARY gmp)
|
||||
|
||||
if (NETTLE_GMP_LIBRARY)
|
||||
list(APPEND NETTLE_LIBRARIES "${NETTLE_GMP_LIBRARY}")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NETTLE_INCLUDE_DIR AND NETTLE_LIBRARY AND HOGWEED_LIBRARY)
|
||||
if (NOT TARGET Nettle::Nettle)
|
||||
add_library(Nettle::Nettle UNKNOWN IMPORTED)
|
||||
set_target_properties(Nettle::Nettle PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${NETTLE_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "${NETTLE_LIBRARIES}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${NETTLE_LIBRARY}"
|
||||
)
|
||||
endif ()
|
||||
if (NOT TARGET Nettle::Hogweed)
|
||||
add_library(Nettle::Hogweed UNKNOWN IMPORTED)
|
||||
set_target_properties(Nettle::Hogweed PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${NETTLE_INCLUDE_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${HOGWEED_LIBRARY}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (NOT NETTLE_VERSION AND NETTLE_INCLUDE_DIR)
|
||||
file(STRINGS "${NETTLE_INCLUDE_DIR}/nettle/version.h" NETTLE_VER_H REGEX "^#define NETTLE_VERSION_(MAJOR|MINOR) ")
|
||||
string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*$" "\\1.\\2" NETTLE_VERSION "${NETTLE_VER_H}")
|
||||
endif ()
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PkgNettle IMPORTED_TARGET GLOBAL nettle)
|
||||
pkg_check_modules(PkgHogweed IMPORTED_TARGET GLOBAL QUIET hogweed)
|
||||
endif()
|
||||
|
||||
list(APPEND NETTLE_LIBRARIES "${NETTLE_LIBRARY}" "${HOGWEED_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Nettle
|
||||
REQUIRED_VARS NETTLE_LIBRARIES NETTLE_INCLUDE_DIR
|
||||
VERSION_VAR NETTLE_VERSION
|
||||
if(PkgNettle_FOUND AND PkHogweed_FOUND)
|
||||
set(NETTLE_INCLUDE_DIR ${PkgNettle_INCLUDE_DIRS} ${PkgHogweed_INCLUDE_DIRS} CACHE FILEPATH "Nettle include path")
|
||||
set(NETTLE_LIBRARIES ${PkgNettle_LIBRARIES} ${PkgHogweed_LIBRARIES} CACHE STRING "Nettle libraries")
|
||||
set(NETTLE_VERSION ${PkgNettle_VERSION})
|
||||
add_library(Nettle::Nettle ALIAS PkgConfig::PkgNettle)
|
||||
add_library(Nettle::Hogweed ALIAS PkgConfig::PkgHogweed)
|
||||
set(Nettle_FOUND ON)
|
||||
else()
|
||||
find_path(NETTLE_INCLUDE_DIR nettle/version.h
|
||||
HINTS
|
||||
"${NETTLE_DIR}"
|
||||
"${NETTLE_DIR}/include"
|
||||
)
|
||||
|
||||
find_library(NETTLE_LIBRARY NAMES nettle libnettle
|
||||
HINTS
|
||||
"${NETTLE_DIR}"
|
||||
"${NETTLE_DIR}/lib"
|
||||
)
|
||||
|
||||
find_library(HOGWEED_LIBRARY NAMES hogweed libhogweed
|
||||
HINTS
|
||||
"${NETTLE_DIR}"
|
||||
"${NETTLE_DIR}/lib"
|
||||
)
|
||||
|
||||
mark_as_advanced(NETTLE_INCLUDE_DIR NETTLE_LIBRARIES NETTLE_LIBRARY HOGWEED_LIBRARY)
|
||||
set(_NETTLE_LIBRARIES ${NETTLE_LIBRARY} ${HOGWEED_LIBRARY})
|
||||
|
||||
# May need gmp library on Unix.
|
||||
if (UNIX)
|
||||
find_library(NETTLE_GMP_LIBRARY gmp)
|
||||
endif ()
|
||||
if (NETTLE_GMP_LIBRARY)
|
||||
list(APPEND _NETTLE_LIBRARIES "${NETTLE_GMP_LIBRARY}")
|
||||
endif ()
|
||||
set(NETTLE_LIBRARIES ${_NETTLE_LIBRARIES} CACHE STRING "nettle libraries")
|
||||
|
||||
|
||||
if (NETTLE_INCLUDE_DIR AND NETTLE_LIBRARY AND HOGWEED_LIBRARY)
|
||||
if (NOT TARGET Nettle::Nettle)
|
||||
add_library(Nettle::Nettle UNKNOWN IMPORTED)
|
||||
set_target_properties(Nettle::Nettle PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${NETTLE_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "${NETTLE_LIBRARIES}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${NETTLE_LIBRARY}"
|
||||
)
|
||||
endif ()
|
||||
if (NOT TARGET Nettle::Hogweed)
|
||||
add_library(Nettle::Hogweed UNKNOWN IMPORTED)
|
||||
set_target_properties(Nettle::Hogweed PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${NETTLE_INCLUDE_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${HOGWEED_LIBRARY}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (NOT NETTLE_VERSION AND NETTLE_INCLUDE_DIR)
|
||||
file(STRINGS "${NETTLE_INCLUDE_DIR}/nettle/version.h" NETTLE_VER_H REGEX "^#define NETTLE_VERSION_(MAJOR|MINOR) ")
|
||||
string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*$" "\\1.\\2" NETTLE_VERSION "${NETTLE_VER_H}")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
list(APPEND NETTLE_LIBRARIES "${NETTLE_LIBRARY}" "${HOGWEED_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Nettle
|
||||
REQUIRED_VARS NETTLE_LIBRARIES NETTLE_INCLUDE_DIR
|
||||
VERSION_VAR NETTLE_VERSION
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(NETTLE_INCLUDE_DIR NETTLE_LIBRARIES NETTLE_LIBRARY HOGWEED_LIBRARY NETTLE_GMP_LIBRARY)
|
||||
|
|
Loading…
Reference in New Issue