Skip to content
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
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ if (CPPKAFKA_RDKAFKA_STATIC_LIB)
add_definitions("-DLIBRDKAFKA_STATICLIB")
endif()

if (NOT CPPKAFKA_PKGCONFIG_DIR)
set(CPPKAFKA_PKGCONFIG_DIR share/pkgconfig)
endif()

# Look for Boost (just need boost.optional headers here)
find_package(Boost REQUIRED ${FIND_PACKAGE_QUIET})
find_package(RdKafka REQUIRED ${FIND_PACKAGE_QUIET})
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ The following cmake options can be specified:
* `CPPKAFKA_BOOST_STATIC_LIBS` : Link with Boost static libraries. Default is `ON`.
* `CPPKAFKA_BOOST_USE_MULTITHREADED` : Use Boost multi-threaded libraries. Default is `ON`.
* `CPPKAFKA_RDKAFKA_STATIC_LIB` : Link to Rdkafka static library. Default is `OFF`.
* `CPPKAFKA_PKGCONFIG_DIR` : Install location of the .pc file. Default is `share/pkgconfig`.

Example:
```Shell
Expand Down
14 changes: 14 additions & 0 deletions cppkafka.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${prefix}/lib
sharedlibdir=${prefix}/lib
includedir=${prefix}/include

Name: cppkafka
Url: https://github.com/mfontanini/cppkafka
Description: C++ wrapper library on top of RdKafka
Version: @CPPKAFKA_VERSION@
Requires: librdkafka >= 0.9.4
Requires.private:
Libs: -L${libdir} -L${sharedlibdir} -L@RDKAFKA_ROOT_DIR@/lib -lcppkafka -lrdkafka -lpthread -lrt -lssl -lcrypto -ldl -lz
Cflags: -I${includedir} -I${includedir}/cppkafka -I@RDKAFKA_INCLUDE_DIR@ -I@Boost_INCLUDE_DIRS@
2 changes: 1 addition & 1 deletion include/cppkafka/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function(make_cppkafka_header)
endforeach()

#create file from template
configure_file(${PROJECT_SOURCE_DIR}/cppkafka.h.in ${CPPKAFKA_HEADER})
configure_file(${PROJECT_SOURCE_DIR}/cppkafka.h.in ${CPPKAFKA_HEADER} @ONLY)
endfunction()

# Run file generation function
Expand Down
12 changes: 11 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,19 @@ endif()
target_link_libraries(cppkafka ${DEPENDENCIES})
target_include_directories(cppkafka PUBLIC ${PROJECT_SOURCE_DIR}/include)

install(
install(
TARGETS cppkafka
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
COMPONENT dev
)

# Generate package configuration file
set(PKG_CONFIG ${PROJECT_SOURCE_DIR}/package/cppkafka.pc)
configure_file(${PROJECT_SOURCE_DIR}/cppkafka.pc.in ${PKG_CONFIG} @ONLY)

install(
FILES ${PKG_CONFIG}
DESTINATION ${CPPKAFKA_PKGCONFIG_DIR}
COMPONENT pkgconfig
)