From 0672fc59e276353e8d5d1dcab9e2211653ac6226 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Mon, 9 Dec 2024 14:38:42 +0100 Subject: [PATCH] [OMON-793] Restore the kafka dependency. --- CMakeLists.txt | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 708edcf5..f22b8c91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2019-2020 CERN and copyright holders of ALICE O2. +# Copyright 2019-2024 CERN and copyright holders of ALICE O2. # See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. # All rights not expressly granted are reserved. # @@ -76,11 +76,19 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") find_package(Boost 1.70 REQUIRED COMPONENTS unit_test_framework program_options system) find_package(ApMon MODULE) find_package(CURL MODULE) -find_package(RdKafka CONFIG) find_package(InfoLogger CONFIG) find_package(Protobuf CONFIG) find_package(gRPC CONFIG) +if(RDKAFKA_ROOT) + message("RDKAFKA_ROOT set, we enable corresponding libs and binaries") + find_library(RDKAFKA_LIB "rdkafka++" REQUIRED PATHS ${RDKAFKA_ROOT}/lib) + set(RDKAFKA_INCLUDE "${RDKAFKA_ROOT}/include") + set(RdKafka_FOUND true) +else() + message("RDKAFKA_ROOT not set, corresponding libs and binaries won't be built") +endif() + #################################### # Set OUTPUT vars #################################### @@ -142,6 +150,7 @@ target_include_directories(Monitoring PUBLIC $ $ + $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ) @@ -153,7 +162,7 @@ set_target_properties(Monitoring PROPERTIES OUTPUT_NAME "O2Monitoring") target_link_libraries(Monitoring PUBLIC Boost::boost - $<$:RdKafka::rdkafka++> + $<$:${RDKAFKA_LIB}> PRIVATE Boost::system pthread @@ -247,8 +256,10 @@ foreach (example ${EXAMPLES}) add_executable(${example_name} ${example}) target_link_libraries(${example_name} PRIVATE + pthread Monitoring Boost::program_options $<$:CURL::libcurl> + $<$:${RDKAFKA_LIB}> ) endforeach() @@ -290,6 +301,7 @@ if(RdKafka_FOUND AND Protobuf_FOUND AND CURL_FOUND) Boost::program_options protobuf::libprotobuf $<$:AliceO2::InfoLogger> + $<$:${RDKAFKA_LIB}> ) target_compile_definitions(${example_name} PRIVATE $<$:O2_MONITORING_WITH_INFOLOGGER>) target_include_directories(${example_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})