Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CMake pkg-config issue with cURL require #4180

Merged
merged 7 commits into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion packaging/cmake/rdkafka.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@
4 changes: 2 additions & 2 deletions src-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ target_include_directories(rdkafka PUBLIC "$<BUILD_INTERFACE:${dummy}>")

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()

Expand Down Expand Up @@ -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()
Expand All @@ -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}")
Expand Down