mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
synced 2025-11-01 11:07:56 +00:00
Added options to conditionally disable installation of configuration files
This commit is contained in:
@@ -44,6 +44,8 @@ option(CPPKAFKA_DISABLE_EXAMPLES "Disable build of cppkafka examples." OFF)
|
||||
option(CPPKAFKA_BOOST_STATIC_LIBS "Link with Boost static libraries." ON)
|
||||
option(CPPKAFKA_BOOST_USE_MULTITHREADED "Use Boost multithreaded libraries." ON)
|
||||
option(CPPKAFKA_RDKAFKA_STATIC_LIB "Link with Rdkafka static library." OFF)
|
||||
option(CPPKAFKA_EXPORT_PKGCONFIG "Generate 'cppkafka.pc' file" ON)
|
||||
option(CPPKAFKA_EXPORT_CMAKE_CONFIG "Generate CMake config, target and version files." ON)
|
||||
|
||||
# Add FindRdKafka.cmake
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
|
||||
|
||||
@@ -83,6 +83,8 @@ The following cmake options can be specified:
|
||||
* `CPPKAFKA_RDKAFKA_STATIC_LIB` : Link to Rdkafka static library. Default is `OFF`.
|
||||
* `CPPKAFKA_CONFIG_DIR` : Install location of the cmake configuration files. Default is `lib/cmake/cppkafka`.
|
||||
* `CPPKAFKA_PKGCONFIG_DIR` : Install location of the .pc file. Default is `share/pkgconfig`.
|
||||
* `CPPKAFKA_EXPORT_PKGCONFIG` : Generate `cppkafka.pc` file. Default is `ON`.
|
||||
* `CPPKAFKA_EXPORT_CMAKE_CONFIG` : Generate CMake config, target and version files. Default is `ON`.
|
||||
|
||||
Example:
|
||||
```Shell
|
||||
|
||||
@@ -11,7 +11,7 @@ set(RDKAFKA_MIN_VERSION_HEX "@RDKAFKA_MIN_VERSION_HEX@")
|
||||
find_dependency(Boost REQUIRED)
|
||||
|
||||
# Try to find the RdKafka configuration file if present.
|
||||
# This will search default system locations as well as RdKafka_ROOT and RdKafka_Dir paths if specified.
|
||||
# This will search default system locations as well as RdKafka_ROOT and RdKafka_DIR paths if specified.
|
||||
find_package(RdKafka QUIET CONFIG)
|
||||
set(RDKAFKA_TARGET_IMPORTS ${RdKafka_FOUND})
|
||||
if (NOT RdKafka_FOUND)
|
||||
|
||||
@@ -64,14 +64,7 @@ install(
|
||||
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
)
|
||||
|
||||
# Install the exported file
|
||||
install(
|
||||
EXPORT "${TARGET_EXPORT_NAME}"
|
||||
NAMESPACE "${NAMESPACE}"
|
||||
COMPONENT config
|
||||
DESTINATION "${CPPKAFKA_CONFIG_DIR}"
|
||||
)
|
||||
|
||||
if (CPPKAFKA_EXPORT_PKGCONFIG)
|
||||
# Generate and install pkgconfig file
|
||||
configure_file(${PROJECT_SOURCE_DIR}/cmake/cppkafka.pc.in ${PKG_CONFIG_FILE} @ONLY)
|
||||
|
||||
@@ -80,6 +73,16 @@ install(
|
||||
DESTINATION "${CPPKAFKA_PKGCONFIG_DIR}"
|
||||
COMPONENT pkgconfig
|
||||
)
|
||||
endif()
|
||||
|
||||
if (CPPKAFKA_EXPORT_CMAKE_CONFIG)
|
||||
# Install the exported file
|
||||
install(
|
||||
EXPORT "${TARGET_EXPORT_NAME}"
|
||||
NAMESPACE "${NAMESPACE}"
|
||||
COMPONENT config
|
||||
DESTINATION "${CPPKAFKA_CONFIG_DIR}"
|
||||
)
|
||||
|
||||
# Generate CMAKE configuration file and exported targets
|
||||
configure_package_config_file(
|
||||
@@ -101,3 +104,4 @@ install(
|
||||
DESTINATION "${CPPKAFKA_CONFIG_DIR}"
|
||||
COMPONENT config
|
||||
)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user