2019-12-13 11:02:22 +00:00
|
|
|
find_package(PkgConfig QUIET)
|
|
|
|
|
|
|
|
pkg_search_module(PC_rdkafka
|
|
|
|
rdkafka)
|
|
|
|
|
2019-10-10 13:27:35 +00:00
|
|
|
find_path(rdkafka_INCLUDE_DIR
|
2019-12-13 11:02:22 +00:00
|
|
|
NAMES librdkafka/rdkafka.h
|
|
|
|
PATHS ${PC_rdkafka_INCLUDE_DIRS})
|
2019-10-10 13:27:35 +00:00
|
|
|
|
|
|
|
find_library(rdkafka_LIBRARY
|
2019-12-13 11:02:22 +00:00
|
|
|
NAMES rdkafka
|
|
|
|
PATHS ${PC_rdkafka_LIBRARY_DIRS})
|
2019-10-10 13:27:35 +00:00
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
2019-12-13 11:02:22 +00:00
|
|
|
find_package_handle_standard_args(RDKafka
|
|
|
|
REQUIRED_VARS rdkafka_INCLUDE_DIR rdkafka_LIBRARY
|
|
|
|
VERSION_VAR PC_rdkafka_VERSION)
|
2019-10-10 13:27:35 +00:00
|
|
|
|
2019-12-13 11:02:22 +00:00
|
|
|
if(RDKafka_FOUND)
|
|
|
|
set(RDKafka_VERSION ${PC_rdkafka_VERSION})
|
|
|
|
string(REPLACE "." ";" version_list ${PC_rdkafka_VERSION})
|
|
|
|
list(GET version_list 0 RDKafka_VERSION_MAJOR)
|
|
|
|
list(GET version_list 1 RDKafka_VERSION_MINOR)
|
|
|
|
list(GET version_list 2 RDKafka_VERSION_PATCH)
|
2019-10-10 13:27:35 +00:00
|
|
|
|
2019-12-13 11:02:22 +00:00
|
|
|
if(NOT TARGET RDKafka::RDKafka)
|
|
|
|
add_library(RDKafka::RDKafka UNKNOWN IMPORTED)
|
|
|
|
set_target_properties(RDKafka::RDKafka PROPERTIES
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${rdkafka_INCLUDE_DIR}"
|
|
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
|
|
|
IMPORTED_LOCATION "${rdkafka_LIBRARY}")
|
|
|
|
endif()
|
2019-10-10 13:27:35 +00:00
|
|
|
endif()
|