From e1a9b7148e7ae7c55b59249e506d644af38492ed Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 1 Feb 2023 16:39:57 +0100 Subject: [PATCH] add option to install or not the static library --- CMakeLists.txt | 3 ++- librabbitmq/CMakeLists.txt | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc61e88f..7b7590f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,6 +129,7 @@ include(CMakeDependentOption) option(BUILD_SHARED_LIBS "Build rabbitmq-c as a shared library" ON) option(BUILD_STATIC_LIBS "Build rabbitmq-c as a static library" ON) +option(INSTALL_STATIC_LIBS "Install rabbitmq-c static library" ON) option(BUILD_EXAMPLES "Build Examples" OFF) option(BUILD_TOOLS "Build Tools (requires POPT Library)" OFF) @@ -244,7 +245,7 @@ configure_package_config_file( if(BUILD_SHARED_LIBS) list(APPEND INSTALL_TARGETS rabbitmq) endif() -if(BUILD_STATIC_LIBS) +if(BUILD_STATIC_LIBS AND INSTALL_STATIC_LIBS) list(APPEND INSTALL_TARGETS rabbitmq-static) endif() diff --git a/librabbitmq/CMakeLists.txt b/librabbitmq/CMakeLists.txt index 1cc58d58..347c992f 100644 --- a/librabbitmq/CMakeLists.txt +++ b/librabbitmq/CMakeLists.txt @@ -142,10 +142,12 @@ if(BUILD_STATIC_LIBS) set_target_properties(rabbitmq-static PROPERTIES COMPILE_OPTIONS "/Z7") endif() - install(TARGETS rabbitmq-static EXPORT "${targets_export_name}" - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + if(INSTALL_STATIC_LIBS) + install(TARGETS rabbitmq-static EXPORT "${targets_export_name}" + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT rabbitmq-c-development - ) + ) + endif() add_library(rabbitmq::rabbitmq-static ALIAS rabbitmq-static) endif()