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,48 +28,62 @@ This module will set the following variables in your project:
|
|||
|
||||
#]=======================================================================]
|
||||
|
||||
find_path(CHECK_INCLUDE_DIR check.h
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PkgCheck IMPORTED_TARGET GLOBAL check)
|
||||
endif ()
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
# 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
|
||||
# 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 (NOT CHECK_LIBRARY)
|
||||
if (NOT CHECK_LIBRARY)
|
||||
find_library(CHECK_LIBRARY NAMES check libcheck
|
||||
HINTS
|
||||
"${CHECK_DIR}"
|
||||
"${CHECK_DIR}/lib"
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
set(CHECK_LIBRARIES "")
|
||||
set(_CHECK_LIBARIES "")
|
||||
|
||||
# Check may need the math, subunit and rt libraries on Unix
|
||||
if (UNIX)
|
||||
# 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}")
|
||||
list(APPEND _CHECK_LIBARIES "${CHECK_MATH_LIBRARY}")
|
||||
endif ()
|
||||
if (CHECK_RT_LIBRARY)
|
||||
list(APPEND CHECK_LIBRARIES "${CHECK_RT_LIBRARY}")
|
||||
list(APPEND _CHECK_LIBARIES "${CHECK_RT_LIBRARY}")
|
||||
endif ()
|
||||
if (CHECK_SUBUNIT_LIBRARY)
|
||||
list(APPEND CHECK_LIBRARIES "${CHECK_SUBUNIT_LIBRARY}")
|
||||
list(APPEND _CHECK_LIBARIES "${CHECK_SUBUNIT_LIBRARY}")
|
||||
endif ()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (CHECK_INCLUDE_DIR AND CHECK_LIBRARY)
|
||||
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
|
||||
|
@ -84,15 +98,17 @@ if (CHECK_INCLUDE_DIR AND CHECK_LIBRARY)
|
|||
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()
|
||||
endif()
|
||||
|
||||
list(APPEND CHECK_LIBRARIES "${CHECK_LIBRARY}")
|
||||
list(APPEND CHECK_LIBRARIES "${CHECK_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Check
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Check
|
||||
REQUIRED_VARS CHECK_LIBRARIES CHECK_INCLUDE_DIR
|
||||
VERSION_VAR CHECK_VERSION
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
mark_as_advanced(CHECK_INCLUDE_DIR CHECK_LIBRARIES CHECK_LIBRARY
|
||||
CHECK_MATH_LIBRARY CHECK_RT_LIBRARY CHECK_SUBUNIT_LIBRARY)
|
||||
|
|
|
@ -30,27 +30,41 @@ This module will set the following variables in your project:
|
|||
|
||||
#]=======================================================================]
|
||||
|
||||
find_path(GNUTLS_INCLUDE_DIR gnutls/gnutls.h
|
||||
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 ()
|
||||
|
||||
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
|
||||
find_library(GNUTLS_LIBRARY NAMES gnutls libgnutls
|
||||
HINTS
|
||||
"${GNUTLS_DIR}"
|
||||
"${GNUTLS_DIR}/lib"
|
||||
)
|
||||
)
|
||||
|
||||
find_library(GNUTLS_DANE_LIBRARY NAMES gnutls-dane libgnutls-dane
|
||||
find_library(GNUTLS_DANE_LIBRARY NAMES gnutls-dane libgnutls-dane
|
||||
HINTS
|
||||
"${GNUTLS_DIR}"
|
||||
"${GNUTLS_DIR}/lib"
|
||||
)
|
||||
)
|
||||
|
||||
set(GNUTLS_LIBRARIES "")
|
||||
set(_GNUTLS_LIBRARIES "")
|
||||
|
||||
if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY AND GNUTLS_DANE_LIBRARY)
|
||||
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
|
||||
|
@ -72,14 +86,16 @@ if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY AND GNUTLS_DANE_LIBRARY)
|
|||
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()
|
||||
endif ()
|
||||
|
||||
list(APPEND GNUTLS_LIBRARIES "${GNUTLS_LIBRARY}" "${GNUTLS_DANE_LIBRARY}")
|
||||
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
|
||||
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,27 +28,37 @@ This module will set the following variables in your project:
|
|||
|
||||
#]=======================================================================]
|
||||
|
||||
find_path(LIBEVENT2_INCLUDE_DIR event2/event.h
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PkgLibevent IMPORTED_TARGET GLOBAL QUIET libevent>=2)
|
||||
endif ()
|
||||
|
||||
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_LIBRARY NAMES event_core libevent_core
|
||||
find_library(LIBEVENT2_LIBRARIES NAMES event_core libevent_core
|
||||
HINTS
|
||||
"${LIBEVENT2_DIR}"
|
||||
"${LIBEVENT2_DIR}/lib"
|
||||
)
|
||||
)
|
||||
|
||||
set(LIBEVENT2_LIBRARIES "")
|
||||
|
||||
if (LIBEVENT2_INCLUDE_DIR AND LIBEVENT2_LIBRARY)
|
||||
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_LIBRARY}"
|
||||
IMPORTED_LOCATION "${LIBEVENT2_LIBRARIES}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
|
@ -56,14 +66,13 @@ if (LIBEVENT2_INCLUDE_DIR AND LIBEVENT2_LIBRARY)
|
|||
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()
|
||||
endif ()
|
||||
|
||||
list(APPEND LIBEVENT2_LIBRARIES "${LIBEVENT2_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libevent2
|
||||
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 LIBEVENT2_LIBRARY)
|
||||
mark_as_advanced(LIBEVENT2_INCLUDE_DIR LIBEVENT2_LIBRARIES)
|
||||
|
|
|
@ -28,27 +28,37 @@ This module will set the following variables in your project:
|
|||
|
||||
#]=======================================================================]
|
||||
|
||||
find_path(LIBIDN2_INCLUDE_DIR idn2.h
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PkgLibIdn2 IMPORTED_TARGET GLOBAL libidn2)
|
||||
endif ()
|
||||
|
||||
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"
|
||||
)
|
||||
)
|
||||
|
||||
find_library(LIBIDN2_LIBRARY NAMES idn2 libidn2
|
||||
find_library(LIBIDN2_LIBRARIES NAMES idn2 libidn2
|
||||
HINTS
|
||||
"${LIBIDN2_DIR}"
|
||||
"${LIBIDN2_DIR}/lib"
|
||||
)
|
||||
)
|
||||
|
||||
set(LIBIDN2_LIBRARIES "")
|
||||
|
||||
if (LIBIDN2_INCLUDE_DIR AND LIBIDN2_LIBRARY)
|
||||
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_LIBRARY}"
|
||||
IMPORTED_LOCATION "${LIBIDN2_LIBRARIES}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
|
@ -56,14 +66,12 @@ if (LIBIDN2_INCLUDE_DIR AND LIBIDN2_LIBRARY)
|
|||
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
|
||||
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 LIBIDN2_LIBRARY)
|
||||
mark_as_advanced(LIBIDN2_INCLUDE_DIR LIBIDN2_LIBRARIES)
|
||||
|
|
|
@ -28,29 +28,41 @@ This module will set the following variables in your project:
|
|||
|
||||
#]=======================================================================]
|
||||
|
||||
find_path(LIBUNBOUND_INCLUDE_DIR unbound.h
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PkgLibunbound IMPORTED_TARGET GLOBAL QUIET libunbound)
|
||||
endif ()
|
||||
|
||||
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
|
||||
find_library(LIBUNBOUND_LIBRARY NAMES unbound
|
||||
HINTS
|
||||
"${LIBUNBOUND_DIR}"
|
||||
"${LIBUNBOUND_DIR}/lib"
|
||||
)
|
||||
)
|
||||
|
||||
set(LIBUNBOUND_LIBRARIES "")
|
||||
set(_LIBUNBOUND_LIBRARIES "")
|
||||
|
||||
if (UNIX)
|
||||
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()
|
||||
list(APPEND _LIBUNBOUND_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
|
||||
list(APPEND _LIBUNBOUND_LIBRARIES "${OPENSSL_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
if (LIBUNBOUND_INCLUDE_DIR AND LIBUNBOUND_LIBRARY)
|
||||
if (LIBUNBOUND_INCLUDE_DIR AND LIBUNBOUND_LIBRARY)
|
||||
if (NOT TARGET Libunbound::Libunbound)
|
||||
add_library(Libunbound::Libunbound UNKNOWN IMPORTED)
|
||||
set_target_properties(Libunbound::Libunbound PROPERTIES
|
||||
|
@ -77,14 +89,16 @@ if (LIBUNBOUND_INCLUDE_DIR AND LIBUNBOUND_LIBRARY)
|
|||
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()
|
||||
endif ()
|
||||
|
||||
list(APPEND LIBUNBOUND_LIBRARIES "${LIBUNBOUND_LIBRARY}")
|
||||
list(APPEND _LIBUNBOUND_LIBRARIES "${LIBUNBOUND_LIBRARY}")
|
||||
set(LIBUNBOUND_LIBRARIES ${_LIBUNBOUND_LIBRARIES} CACHE STRING "libunbound libraries")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libunbound
|
||||
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,27 +28,37 @@ This module will set the following variables in your project:
|
|||
|
||||
#]=======================================================================]
|
||||
|
||||
find_path(LIBUV_INCLUDE_DIR uv.h
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PkgLibuv IMPORTED_TARGET GLOBAL libuv)
|
||||
endif ()
|
||||
|
||||
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_LIBRARY NAMES uv libuv
|
||||
find_library(LIBUV_LIBRARIES NAMES uv libuv
|
||||
HINTS
|
||||
"${LIBUV_DIR}"
|
||||
"${LIBUV_DIR}/lib"
|
||||
)
|
||||
)
|
||||
|
||||
set(LIBUV_LIBRARIES "")
|
||||
|
||||
if (LIBUV_INCLUDE_DIR AND LIBUV_LIBRARY)
|
||||
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}"
|
||||
IMPORTED_LOCATION "${LIBUV_LIBRARIES}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
|
@ -60,14 +70,13 @@ if (LIBUV_INCLUDE_DIR AND LIBUV_LIBRARY)
|
|||
endif ()
|
||||
string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*_PATCH ([0-9]+).*$" "\\1.\\2.\\3" LIBUV_VERSION "${LIBUV_VER_H}")
|
||||
endif ()
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
list(APPEND LIBUV_LIBRARIES "${LIBUV_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libuv
|
||||
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 LIBUV_LIBRARY)
|
||||
mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARIES)
|
||||
|
|
|
@ -30,36 +30,51 @@ This module will set the following variables in your project:
|
|||
|
||||
#]=======================================================================]
|
||||
|
||||
find_path(NETTLE_INCLUDE_DIR nettle/version.h
|
||||
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()
|
||||
|
||||
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
|
||||
find_library(NETTLE_LIBRARY NAMES nettle libnettle
|
||||
HINTS
|
||||
"${NETTLE_DIR}"
|
||||
"${NETTLE_DIR}/lib"
|
||||
)
|
||||
)
|
||||
|
||||
find_library(HOGWEED_LIBRARY NAMES hogweed libhogweed
|
||||
find_library(HOGWEED_LIBRARY NAMES hogweed libhogweed
|
||||
HINTS
|
||||
"${NETTLE_DIR}"
|
||||
"${NETTLE_DIR}/lib"
|
||||
)
|
||||
)
|
||||
|
||||
set(NETTLE_LIBRARIES "")
|
||||
set(_NETTLE_LIBRARIES ${NETTLE_LIBRARY} ${HOGWEED_LIBRARY})
|
||||
|
||||
# May need gmp library on Unix.
|
||||
if (UNIX)
|
||||
# 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_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 (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
|
||||
|
@ -82,14 +97,15 @@ if (NETTLE_INCLUDE_DIR AND NETTLE_LIBRARY AND HOGWEED_LIBRARY)
|
|||
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()
|
||||
endif()
|
||||
|
||||
list(APPEND NETTLE_LIBRARIES "${NETTLE_LIBRARY}" "${HOGWEED_LIBRARY}")
|
||||
list(APPEND NETTLE_LIBRARIES "${NETTLE_LIBRARY}" "${HOGWEED_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Nettle
|
||||
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)
|
||||
mark_as_advanced(NETTLE_INCLUDE_DIR NETTLE_LIBRARIES NETTLE_LIBRARY HOGWEED_LIBRARY NETTLE_GMP_LIBRARY)
|
||||
|
|
Loading…
Reference in New Issue