diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /cmake/modules/FindRDKafka.cmake | |
parent | Initial commit. (diff) | |
download | ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/modules/FindRDKafka.cmake')
-rw-r--r-- | cmake/modules/FindRDKafka.cmake | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/cmake/modules/FindRDKafka.cmake b/cmake/modules/FindRDKafka.cmake new file mode 100644 index 00000000..78f7d825 --- /dev/null +++ b/cmake/modules/FindRDKafka.cmake @@ -0,0 +1,33 @@ +find_package(PkgConfig QUIET) + +pkg_search_module(PC_rdkafka + rdkafka) + +find_path(rdkafka_INCLUDE_DIR + NAMES librdkafka/rdkafka.h + PATHS ${PC_rdkafka_INCLUDE_DIRS}) + +find_library(rdkafka_LIBRARY + NAMES rdkafka + PATHS ${PC_rdkafka_LIBRARY_DIRS}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(RDKafka + REQUIRED_VARS rdkafka_INCLUDE_DIR rdkafka_LIBRARY + VERSION_VAR PC_rdkafka_VERSION) + +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) + + 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() +endif() |