File tree Expand file tree Collapse file tree 5 files changed +31
-2
lines changed
Expand file tree Collapse file tree 5 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,10 @@ if (CPPKAFKA_RDKAFKA_STATIC_LIB)
5656 add_definitions ("-DLIBRDKAFKA_STATICLIB" )
5757endif ()
5858
59+ if (NOT CPPKAFKA_PKGCONFIG_DIR)
60+ set (CPPKAFKA_PKGCONFIG_DIR share/pkgconfig)
61+ endif ()
62+
5963# Look for Boost (just need boost.optional headers here)
6064find_package (Boost REQUIRED ${FIND_PACKAGE_QUIET} )
6165find_package (RdKafka REQUIRED ${FIND_PACKAGE_QUIET} )
Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ The following cmake options can be specified:
8080* ` CPPKAFKA_BOOST_STATIC_LIBS ` : Link with Boost static libraries. Default is ` ON ` .
8181* ` CPPKAFKA_BOOST_USE_MULTITHREADED ` : Use Boost multi-threaded libraries. Default is ` ON ` .
8282* ` CPPKAFKA_RDKAFKA_STATIC_LIB ` : Link to Rdkafka static library. Default is ` OFF ` .
83+ * ` CPPKAFKA_PKGCONFIG_DIR ` : Install location of the .pc file. Default is ` share/pkgconfig ` .
8384
8485Example:
8586``` Shell
Original file line number Diff line number Diff line change 1+ prefix=@CMAKE_INSTALL_PREFIX@
2+ exec_prefix=${prefix}
3+ libdir=${prefix}/lib
4+ sharedlibdir=${prefix}/lib
5+ includedir=${prefix}/include
6+
7+ Name: cppkafka
8+ Url: https://github.com/mfontanini/cppkafka
9+ Description: C++ wrapper library on top of RdKafka
10+ Version: @CPPKAFKA_VERSION@
11+ Requires: librdkafka >= 0.9.4
12+ Requires.private:
13+ Libs: -L${libdir} -L${sharedlibdir} -L@RDKAFKA_ROOT_DIR@/lib -lcppkafka -lrdkafka -lpthread -lrt -lssl -lcrypto -ldl -lz
14+ Cflags: -I${includedir} -I${includedir}/cppkafka -I@RDKAFKA_INCLUDE_DIR@ -I@Boost_INCLUDE_DIRS@
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ function(make_cppkafka_header)
1010 endforeach ()
1111
1212 #create file from template
13- configure_file (${PROJECT_SOURCE_DIR} /cppkafka.h.in ${CPPKAFKA_HEADER} )
13+ configure_file (${PROJECT_SOURCE_DIR} /cppkafka.h.in ${CPPKAFKA_HEADER} @ONLY )
1414endfunction ()
1515
1616# Run file generation function
Original file line number Diff line number Diff line change @@ -41,9 +41,19 @@ endif()
4141target_link_libraries (cppkafka ${DEPENDENCIES} )
4242target_include_directories (cppkafka PUBLIC ${PROJECT_SOURCE_DIR} /include )
4343
44- install (
44+ install (
4545 TARGETS cppkafka
4646 LIBRARY DESTINATION lib
4747 ARCHIVE DESTINATION lib
4848 COMPONENT dev
4949)
50+
51+ # Generate package configuration file
52+ set (PKG_CONFIG ${PROJECT_SOURCE_DIR} /package/cppkafka.pc)
53+ configure_file (${PROJECT_SOURCE_DIR} /cppkafka.pc.in ${PKG_CONFIG} @ONLY)
54+
55+ install (
56+ FILES ${PKG_CONFIG}
57+ DESTINATION ${CPPKAFKA_PKGCONFIG_DIR}
58+ COMPONENT pkgconfig
59+ )
You can’t perform that action at this time.
0 commit comments