diff --git a/CMakeLists.txt b/CMakeLists.txt index 11f81aae..a16a1ef5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -272,6 +272,23 @@ if (BUILD_OPTION_GEN_COVERAGE) message(STATUS "Enable code coverage data generation") endif () +set(MODERN_CPP_KAFKA_CMAKE_DESTINATION share/cmake/modern-cpp-kafka) + +include(CMakePackageConfigHelpers) +configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/modern-cpp-kafka-config.cmake.in" + ${CMAKE_CURRENT_BINARY_DIR}/cmake/modern-cpp-kafka-config.cmake + INSTALL_DESTINATION share/cmake/modern-cpp-kafka + NO_CHECK_REQUIRED_COMPONENTS_MACRO) + +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cmake/modern-cpp-kafka-config.cmake" + DESTINATION "${MODERN_CPP_KAFKA_CMAKE_DESTINATION}") + +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/modern-cpp-kafka.pc.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake/modern-cpp-kafka.pc" @ONLY) + +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cmake/modern-cpp-kafka.pc" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + #--------------------------- # Build Sub-directories diff --git a/cmake/modern-cpp-kafka-config.cmake.in b/cmake/modern-cpp-kafka-config.cmake.in new file mode 100644 index 00000000..74c7f01d --- /dev/null +++ b/cmake/modern-cpp-kafka-config.cmake.in @@ -0,0 +1,8 @@ +set(MODERN_CPP_KAFKA_VERSION 2023.03.07) +... +@PACKAGE_INIT@ +... +set_and_check(MODERN_CPP_KAFKA_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") +# set_and_check(MODERN_CPP_KAFKA_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@") + +check_required_components(ModernCppKafka) diff --git a/cmake/modern-cpp-kafka.pc.in b/cmake/modern-cpp-kafka.pc.in new file mode 100644 index 00000000..4477999d --- /dev/null +++ b/cmake/modern-cpp-kafka.pc.in @@ -0,0 +1,10 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +includedir=${prefix}/include + +Name: modern-cpp-kafka +Description: A C++ API for Kafka clients (i.e. KafkaProducer, KafkaConsumer, AdminClient) +Version: @PROJECT_VERSION@ +URL: https://github.com/morganstanley/modern-cpp-kafka +Requires: @MODERN_CPP_KAFKA_DEPENDS@ +Cflags: -I${includedir}