From 117c63345e6261b33f1c02475be5332d43ab1267 Mon Sep 17 00:00:00 2001 From: driverxdw <973858433@qq.com> Date: Mon, 27 Nov 2023 09:49:17 +0000 Subject: [PATCH 1/2] add static library installation in CMakeLists.txt of libclamav submodules --- libclamav_rust/CMakeLists.txt | 6 ++++++ libclammspack/CMakeLists.txt | 7 +++++++ libclamunrar/CMakeLists.txt | 7 +++++++ libclamunrar_iface/CMakeLists.txt | 7 +++++++ 4 files changed, 27 insertions(+) diff --git a/libclamav_rust/CMakeLists.txt b/libclamav_rust/CMakeLists.txt index 7df3ffee91..8da00bb6fb 100644 --- a/libclamav_rust/CMakeLists.txt +++ b/libclamav_rust/CMakeLists.txt @@ -17,4 +17,10 @@ if (WIN32) target_link_libraries(clamav_rust PUBLIC INTERFACE Userenv) endif() +if(WIN32) + install(FILES $ DESTINATION . COMPONENT libraries) +else() + install(FILES $ DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) +endif() + add_library(ClamAV::libclamav_rust ALIAS clamav_rust) diff --git a/libclammspack/CMakeLists.txt b/libclammspack/CMakeLists.txt index f441eb2817..31d57b4fa9 100644 --- a/libclammspack/CMakeLists.txt +++ b/libclammspack/CMakeLists.txt @@ -103,6 +103,13 @@ if(ENABLE_STATIC_LIB) ${CMAKE_CURRENT_BINARY_DIR} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/mspack ) + if(WIN32) + install(TARGETS clammspack_static DESTINATION . COMPONENT libraries) + install(FILES $ DESTINATION . OPTIONAL COMPONENT libraries) + else() + install(TARGETS clammspack_static DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) + endif() + add_library( ClamAV::libmspack_static ALIAS clammspack_static ) if(NOT ENABLE_SHARED_LIB) add_library( ClamAV::libmspack ALIAS clammspack_static ) diff --git a/libclamunrar/CMakeLists.txt b/libclamunrar/CMakeLists.txt index 7d6f393f10..5b0cb1401d 100644 --- a/libclamunrar/CMakeLists.txt +++ b/libclamunrar/CMakeLists.txt @@ -133,6 +133,13 @@ if(ENABLE_STATIC_LIB) COMPILE_FLAGS "-Wno-logical-op-parentheses -Wno-switch -Wno-dangling-else") endif() + if(WIN32) + install(TARGETS clamunrar_static DESTINATION . COMPONENT libraries) + install(FILES $ DESTINATION . OPTIONAL COMPONENT libraries) + else() + install(TARGETS clamunrar_static DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) + endif() + add_library( ClamAV::libunrar_static ALIAS clamunrar_static ) if(NOT ENABLE_SHARED_LIB) add_library( ClamAV::libunrar ALIAS clamunrar_static ) diff --git a/libclamunrar_iface/CMakeLists.txt b/libclamunrar_iface/CMakeLists.txt index e193adc5ae..3ab3cfee55 100644 --- a/libclamunrar_iface/CMakeLists.txt +++ b/libclamunrar_iface/CMakeLists.txt @@ -109,6 +109,13 @@ if(ENABLE_UNRAR) PRIVATE ClamAV::libunrar_static ) + if(WIN32) + install(TARGETS clamunrar_iface_static DESTINATION . COMPONENT libraries) + install( FILES $ DESTINATION . OPTIONAL COMPONENT libraries ) + else() + install(TARGETS clamunrar_iface_static DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) + endif() + add_library( ClamAV::libunrar_iface_static ALIAS clamunrar_iface_static ) if(NOT ENABLE_SHARED_LIB) add_library( ClamAV::libunrar_iface ALIAS clamunrar_iface_static ) From dddc8e5c4a313fbfda64e057f6be6e52fa187cb5 Mon Sep 17 00:00:00 2001 From: driverxdw <973858433@qq.com> Date: Tue, 28 Nov 2023 14:12:45 +0800 Subject: [PATCH 2/2] Remove incorrect installation statement Co-authored-by: Micah Snyder --- libclammspack/CMakeLists.txt | 1 - libclamunrar/CMakeLists.txt | 1 - libclamunrar_iface/CMakeLists.txt | 1 - 3 files changed, 3 deletions(-) diff --git a/libclammspack/CMakeLists.txt b/libclammspack/CMakeLists.txt index 31d57b4fa9..e09b0cfb56 100644 --- a/libclammspack/CMakeLists.txt +++ b/libclammspack/CMakeLists.txt @@ -105,7 +105,6 @@ if(ENABLE_STATIC_LIB) if(WIN32) install(TARGETS clammspack_static DESTINATION . COMPONENT libraries) - install(FILES $ DESTINATION . OPTIONAL COMPONENT libraries) else() install(TARGETS clammspack_static DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) endif() diff --git a/libclamunrar/CMakeLists.txt b/libclamunrar/CMakeLists.txt index 5b0cb1401d..97eb4ccc95 100644 --- a/libclamunrar/CMakeLists.txt +++ b/libclamunrar/CMakeLists.txt @@ -135,7 +135,6 @@ if(ENABLE_STATIC_LIB) if(WIN32) install(TARGETS clamunrar_static DESTINATION . COMPONENT libraries) - install(FILES $ DESTINATION . OPTIONAL COMPONENT libraries) else() install(TARGETS clamunrar_static DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) endif() diff --git a/libclamunrar_iface/CMakeLists.txt b/libclamunrar_iface/CMakeLists.txt index 3ab3cfee55..8a55692919 100644 --- a/libclamunrar_iface/CMakeLists.txt +++ b/libclamunrar_iface/CMakeLists.txt @@ -111,7 +111,6 @@ if(ENABLE_UNRAR) if(WIN32) install(TARGETS clamunrar_iface_static DESTINATION . COMPONENT libraries) - install( FILES $ DESTINATION . OPTIONAL COMPONENT libraries ) else() install(TARGETS clamunrar_iface_static DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) endif()