Verified Commit bc7dff55 authored by Pavel Doležal's avatar Pavel Doležal
Browse files

CMake: Add libmaxminddb as a dependency (ASN and Country Code lookup)

parent 0c0c4bcf
......@@ -22,6 +22,7 @@ find_package(PCAP REQUIRED)
find_package(Boost REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(Yaml-cpp REQUIRED)
find_package(MaxmindDB REQUIRED)
find_package(Doxygen)
include(CheckCXXCompilerFlag)
......@@ -50,7 +51,7 @@ file(GLOB PROBE_SOURCES CONFIGURE_DEPENDS src/core/Probe.cpp
)
add_library(DNSProbe INTERFACE)
target_link_libraries(DNSProbe INTERFACE ${Boost_LIBRARIES} ${YAML_CPP_LIBRARIES} PCAP::PCAP Threads::Threads OpenSSL::SSL)
target_link_libraries(DNSProbe INTERFACE ${Boost_LIBRARIES} ${YAML_CPP_LIBRARIES} PCAP::PCAP Threads::Threads OpenSSL::SSL MaxmindDB::MaxmindDB)
target_compile_definitions(DNSProbe INTERFACE $<$<CONFIG:Debug>:PRINT_DEBUG>)
target_include_directories(DNSProbe INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src ${Boost_INCLUDE_DIRS} ${YAML_CPP_INCLUDE_DIR})
target_compile_options(DNSProbe INTERFACE -msse4)
......
# - Try to find libmaxminddb include dirs and libraries
#
# Usage of this module as follows:
#
# find_package(MaxmindDB)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# MAXMINDDB_ROOT_DIR Set this variable to the root installation of
# libmaxminddb if the module has problems finding the
# proper installation path.
#
# Variables defined by this module:
#
# MAXMINDDB_FOUND System has libmaxminddb, include and library dirs found
# MAXMINDDB_INCLUDE_DIR The libmaxminddb include directories.
# MAXMINDDB_LIBRARY The libmaxminddb library
find_path(MAXMINDDB_ROOT_DIR NAMES maxminddb.h HINTS include/*/)
find_path(MAXMINDDB_INCLUDE_DIR NAMES maxminddb.h HINTS ${MAXMINDDB_ROOT_DIR}/include/*/)
find_library(MAXMINDDB_LIBRARY NAMES maxminddb HINTS ${MAXMINDDB_ROOT_DIR}/lib/*/ ${MAXMINDDB_ROOT_DIR}/lib64/*/)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MaxmindDB DEFAULT_MSG MAXMINDDB_ROOT_DIR MAXMINDDB_LIBRARY)
mark_as_advanced(
MAXMINDDB_ROOT_DIR
MAXMINDDB_INCLUDE_DIR
MAXMINDDB_LIBRARY
)
if(MaxmindDB_FOUND)
add_library(MaxmindDB::MaxmindDB INTERFACE IMPORTED)
set_property(TARGET MaxmindDB::MaxmindDB PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${MAXMINDDB_INCLUDE_DIR})
set_property(TARGET MaxmindDB::MaxmindDB PROPERTY INTERFACE_LINK_LIBRARIES ${MAXMINDDB_LIBRARY})
endif()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment