diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ed6665435..8f11cd62c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ librdkafka v2.1.1 is a maintenance release: calling `rd_kafka_message_leader_epoch()` on the polled `rkmessage` (#4245). * Fix a segmentation fault when fetching from follower and the partition lease expires while waiting for the result of a list offsets operation (#4254). + * Fix CMake pkg-config cURL require and use + pkg-config `Requires.private` field (@FantasqueX, @stertingen, #4180). ## Fixes diff --git a/packaging/cmake/rdkafka.pc.in b/packaging/cmake/rdkafka.pc.in index 0eb17e8560..9632cf5134 100644 --- a/packaging/cmake/rdkafka.pc.in +++ b/packaging/cmake/rdkafka.pc.in @@ -6,7 +6,7 @@ libdir=${prefix}/lib Name: @PKG_CONFIG_NAME@ Description: @PKG_CONFIG_DESCRIPTION@ Version: @PKG_CONFIG_VERSION@ -Requires: @PKG_CONFIG_REQUIRES@ +Requires.private: @PKG_CONFIG_REQUIRES_PRIVATE@ Cflags: @PKG_CONFIG_CFLAGS@ Libs: @PKG_CONFIG_LIBS@ Libs.private: @PKG_CONFIG_LIBS_PRIVATE@ diff --git a/src-cpp/CMakeLists.txt b/src-cpp/CMakeLists.txt index b0a6d51e47..2b496d9f9e 100644 --- a/src-cpp/CMakeLists.txt +++ b/src-cpp/CMakeLists.txt @@ -41,7 +41,7 @@ set(PKG_CONFIG_VERSION "${PROJECT_VERSION}") if(NOT RDKAFKA_BUILD_STATIC) set(PKG_CONFIG_NAME "librdkafka++") set(PKG_CONFIG_DESCRIPTION "The Apache Kafka C/C++ library") - set(PKG_CONFIG_REQUIRES "rdkafka") + set(PKG_CONFIG_REQUIRES_PRIVATE "rdkafka") set(PKG_CONFIG_CFLAGS "-I\${includedir}") set(PKG_CONFIG_LIBS "-L\${libdir} -lrdkafka++") set(PKG_CONFIG_LIBS_PRIVATE "-lrdkafka") @@ -57,7 +57,7 @@ if(NOT RDKAFKA_BUILD_STATIC) else() set(PKG_CONFIG_NAME "librdkafka++-static") set(PKG_CONFIG_DESCRIPTION "The Apache Kafka C/C++ library (static)") - set(PKG_CONFIG_REQUIRES "") + set(PKG_CONFIG_REQUIRES_PRIVATE "") set(PKG_CONFIG_CFLAGS "-I\${includedir} -DLIBRDKAFKA_STATICLIB") set(PKG_CONFIG_LIBS "-L\${libdir} \${libdir}/librdkafka++.a") if(WIN32) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 37b43c4996..33481ba1ac 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -199,7 +199,7 @@ target_include_directories(rdkafka PUBLIC "$") if(WITH_CURL) find_package(CURL REQUIRED) - target_include_directories(rdkafka PUBLIC ${CURL_INCLUDE_DIRS}) + target_include_directories(rdkafka PRIVATE ${CURL_INCLUDE_DIRS}) target_link_libraries(rdkafka PUBLIC ${CURL_LIBRARIES}) endif() @@ -272,7 +272,7 @@ endif() # Generate pkg-config file set(PKG_CONFIG_VERSION "${PROJECT_VERSION}") -set(PKG_CONFIG_REQUIRES "") +set(PKG_CONFIG_REQUIRES_PRIVATE "") if (WIN32) set(PKG_CONFIG_LIBS_PRIVATE "-lws2_32 -lsecur32 -lcrypt32") else() @@ -296,27 +296,27 @@ if(NOT RDKAFKA_BUILD_STATIC) set(PKG_CONFIG_DESCRIPTION "The Apache Kafka C/C++ library") if(WITH_CURL) - string(APPEND PKG_CONFIG_REQUIRES "curl ") + string(APPEND PKG_CONFIG_REQUIRES_PRIVATE "libcurl ") endif() if(WITH_ZLIB) - string(APPEND PKG_CONFIG_REQUIRES "zlib ") + string(APPEND PKG_CONFIG_REQUIRES_PRIVATE "zlib ") endif() if(WITH_SSL) - string(APPEND PKG_CONFIG_REQUIRES "libssl ") + string(APPEND PKG_CONFIG_REQUIRES_PRIVATE "libcrypto libssl ") endif() if(WITH_SASL_CYRUS) - string(APPEND PKG_CONFIG_REQUIRES "libsasl2 ") + string(APPEND PKG_CONFIG_REQUIRES_PRIVATE "libsasl2 ") endif() if(WITH_ZSTD) - string(APPEND PKG_CONFIG_REQUIRES "libzstd ") + string(APPEND PKG_CONFIG_REQUIRES_PRIVATE "libzstd ") endif() if(WITH_LZ4_EXT) - string(APPEND PKG_CONFIG_REQUIRES "liblz4 ") + string(APPEND PKG_CONFIG_REQUIRES_PRIVATE "liblz4 ") endif() set(PKG_CONFIG_CFLAGS "-I\${includedir}")