|
@@ -1,73 +1,73 @@
|
|
|
-From 73832f5b7b6c3971d5a7a5cd2c0bcd429cd779c6 Mon Sep 17 00:00:00 2001
|
|
|
+From dea6fb0138d9356ebdc4983a61c185bc759d86b0 Mon Sep 17 00:00:00 2001
|
|
|
From: Thomas Devoogdt <thomas.devoogdt@barco.com>
|
|
|
Date: Tue, 25 Jul 2023 09:10:41 +0200
|
|
|
-Subject: [PATCH] lib: librdkafka: CMakeLists.txt: allow compilation without
|
|
|
- CXX support #7741
|
|
|
-
|
|
|
-e.g. fluent-bit is a c-only library, so allow compilation without cxx
|
|
|
+Subject: [PATCH] lib: librdkafka: only require a C compiler
|
|
|
|
|
|
Upstream: https://github.com/confluentinc/librdkafka/pull/4366
|
|
|
-Upstream: https://github.com/fluent/fluent-bit/pull/9277
|
|
|
Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
|
|
|
---
|
|
|
- lib/librdkafka-2.4.0/CMakeLists.txt | 18 ++++++++++--
|
|
|
- lib/librdkafka-2.4.0/examples/CMakeLists.txt | 31 +++++++++++++-------
|
|
|
- 2 files changed, 35 insertions(+), 14 deletions(-)
|
|
|
+ lib/librdkafka-2.8.0/CMakeLists.txt | 22 ++++++++++++--
|
|
|
+ lib/librdkafka-2.8.0/examples/CMakeLists.txt | 31 +++++++++++++-------
|
|
|
+ 2 files changed, 39 insertions(+), 14 deletions(-)
|
|
|
|
|
|
-diff --git a/lib/librdkafka-2.4.0/CMakeLists.txt b/lib/librdkafka-2.4.0/CMakeLists.txt
|
|
|
-index 7f3dd0fc6..c1ee93062 100644
|
|
|
---- a/lib/librdkafka-2.4.0/CMakeLists.txt
|
|
|
-+++ b/lib/librdkafka-2.4.0/CMakeLists.txt
|
|
|
-@@ -3,7 +3,12 @@ cmake_minimum_required(VERSION 3.2)
|
|
|
+diff --git a/lib/librdkafka-2.8.0/CMakeLists.txt b/lib/librdkafka-2.8.0/CMakeLists.txt
|
|
|
+index f3d05bad7..8ef47053a 100644
|
|
|
+--- a/lib/librdkafka-2.8.0/CMakeLists.txt
|
|
|
++++ b/lib/librdkafka-2.8.0/CMakeLists.txt
|
|
|
+@@ -3,7 +3,16 @@ cmake_minimum_required(VERSION 3.5)
|
|
|
include("packaging/cmake/parseversion.cmake")
|
|
|
parseversion("src/rdkafka.h")
|
|
|
|
|
|
-project(RdKafka VERSION ${RDKAFKA_VERSION})
|
|
|
+project(RdKafka VERSION ${RDKAFKA_VERSION} LANGUAGES C)
|
|
|
+
|
|
|
-+option(RDKAFKA_BUILD_CXX "Enable CXX support" ON)
|
|
|
-+if(RDKAFKA_BUILD_CXX)
|
|
|
++# Check for CXX support
|
|
|
++include(CheckLanguage)
|
|
|
++check_language(CXX)
|
|
|
++if(CMAKE_CXX_COMPILER)
|
|
|
+ enable_language(CXX)
|
|
|
++else()
|
|
|
++ message(STATUS "C++ compiler not found, skipping C++ support")
|
|
|
+endif()
|
|
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/packaging/cmake/Modules/")
|
|
|
|
|
|
-@@ -181,7 +186,11 @@ endif()
|
|
|
+@@ -181,7 +190,11 @@ endif()
|
|
|
|
|
|
option(RDKAFKA_BUILD_STATIC "Build static rdkafka library" OFF)
|
|
|
option(RDKAFKA_BUILD_EXAMPLES "Build examples" ON)
|
|
|
-option(RDKAFKA_BUILD_TESTS "Build tests" ON)
|
|
|
+
|
|
|
-+if(RDKAFKA_BUILD_CXX)
|
|
|
++if(CMAKE_CXX_COMPILER)
|
|
|
+ option(RDKAFKA_BUILD_TESTS "Build tests" ON)
|
|
|
+endif()
|
|
|
+
|
|
|
if(WIN32)
|
|
|
option(WITHOUT_WIN32_CONFIG "Avoid including win32_config.h on cmake builds" ON)
|
|
|
endif(WIN32)
|
|
|
-@@ -279,7 +288,10 @@ install(
|
|
|
+@@ -279,7 +292,10 @@ install(
|
|
|
)
|
|
|
|
|
|
add_subdirectory(src)
|
|
|
-add_subdirectory(src-cpp)
|
|
|
+
|
|
|
-+if(RDKAFKA_BUILD_CXX)
|
|
|
++if(CMAKE_CXX_COMPILER)
|
|
|
+ add_subdirectory(src-cpp)
|
|
|
+endif()
|
|
|
|
|
|
if(RDKAFKA_BUILD_EXAMPLES)
|
|
|
add_subdirectory(examples)
|
|
|
-diff --git a/lib/librdkafka-2.4.0/examples/CMakeLists.txt b/lib/librdkafka-2.4.0/examples/CMakeLists.txt
|
|
|
-index 8c0079abe..c9336b729 100644
|
|
|
---- a/lib/librdkafka-2.4.0/examples/CMakeLists.txt
|
|
|
-+++ b/lib/librdkafka-2.4.0/examples/CMakeLists.txt
|
|
|
+diff --git a/lib/librdkafka-2.8.0/examples/CMakeLists.txt b/lib/librdkafka-2.8.0/examples/CMakeLists.txt
|
|
|
+index 91851d2cb..6874195ce 100644
|
|
|
+--- a/lib/librdkafka-2.8.0/examples/CMakeLists.txt
|
|
|
++++ b/lib/librdkafka-2.8.0/examples/CMakeLists.txt
|
|
|
@@ -5,8 +5,10 @@ endif(WIN32)
|
|
|
add_executable(producer producer.c ${win32_sources})
|
|
|
target_link_libraries(producer PUBLIC rdkafka)
|
|
|
|
|
|
-add_executable(producer_cpp producer.cpp ${win32_sources})
|
|
|
-target_link_libraries(producer_cpp PUBLIC rdkafka++)
|
|
|
-+if(RDKAFKA_BUILD_CXX)
|
|
|
++if(CMAKE_CXX_COMPILER)
|
|
|
+ add_executable(producer_cpp producer.cpp ${win32_sources})
|
|
|
+ target_link_libraries(producer_cpp PUBLIC rdkafka++)
|
|
|
+endif()
|
|
@@ -80,35 +80,35 @@ index 8c0079abe..c9336b729 100644
|
|
|
|
|
|
-add_executable(rdkafka_example_cpp rdkafka_example.cpp ${win32_sources})
|
|
|
-target_link_libraries(rdkafka_example_cpp PUBLIC rdkafka++)
|
|
|
-+if(RDKAFKA_BUILD_CXX)
|
|
|
++if(CMAKE_CXX_COMPILER)
|
|
|
+ add_executable(rdkafka_example_cpp rdkafka_example.cpp ${win32_sources})
|
|
|
+ target_link_libraries(rdkafka_example_cpp PUBLIC rdkafka++)
|
|
|
+endif()
|
|
|
|
|
|
-add_executable(rdkafka_complex_consumer_example_cpp rdkafka_complex_consumer_example.cpp ${win32_sources})
|
|
|
-target_link_libraries(rdkafka_complex_consumer_example_cpp PUBLIC rdkafka++)
|
|
|
-+if(RDKAFKA_BUILD_CXX)
|
|
|
++if(CMAKE_CXX_COMPILER)
|
|
|
+ add_executable(rdkafka_complex_consumer_example_cpp rdkafka_complex_consumer_example.cpp ${win32_sources})
|
|
|
+ target_link_libraries(rdkafka_complex_consumer_example_cpp PUBLIC rdkafka++)
|
|
|
+endif()
|
|
|
|
|
|
-add_executable(openssl_engine_example_cpp openssl_engine_example.cpp ${win32_sources})
|
|
|
-target_link_libraries(openssl_engine_example_cpp PUBLIC rdkafka++)
|
|
|
-+if(RDKAFKA_BUILD_CXX)
|
|
|
++if(CMAKE_CXX_COMPILER)
|
|
|
+ add_executable(openssl_engine_example_cpp openssl_engine_example.cpp ${win32_sources})
|
|
|
+ target_link_libraries(openssl_engine_example_cpp PUBLIC rdkafka++)
|
|
|
+endif()
|
|
|
|
|
|
add_executable(misc misc.c ${win32_sources})
|
|
|
target_link_libraries(misc PUBLIC rdkafka)
|
|
|
-@@ -70,7 +78,8 @@ if(NOT WIN32)
|
|
|
+@@ -73,7 +81,8 @@ if(NOT WIN32)
|
|
|
add_executable(rdkafka_complex_consumer_example rdkafka_complex_consumer_example.c)
|
|
|
target_link_libraries(rdkafka_complex_consumer_example PUBLIC rdkafka)
|
|
|
|
|
|
- add_executable(kafkatest_verifiable_client kafkatest_verifiable_client.cpp)
|
|
|
- target_link_libraries(kafkatest_verifiable_client PUBLIC rdkafka++)
|
|
|
-
|
|
|
-+ if(RDKAFKA_BUILD_CXX)
|
|
|
++ if(CMAKE_CXX_COMPILER)
|
|
|
+ add_executable(kafkatest_verifiable_client kafkatest_verifiable_client.cpp)
|
|
|
+ target_link_libraries(kafkatest_verifiable_client PUBLIC rdkafka++)
|
|
|
+ endif()
|