diff --git a/CMakeLists.txt b/CMakeLists.txt index 40494872c4..80de8c7d9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -548,21 +548,21 @@ if(${bytecodeRuntime} STREQUAL "llvm") endif() endif() +if(APPLE) + find_library(APPLE_CORE_FOUNDATION CoreFoundation) + if (NOT APPLE_CORE_FOUNDATION) + message(FATAL_ERROR "Apple CoreFoundation framework not found") + endif() + find_library(APPLE_SECURITY Security) + if (NOT APPLE_SECURITY) + message(FATAL_ERROR "Apple Security framework not found") + endif() +endif() + # libfreshclam & application dependencies if(NOT ENABLE_LIBCLAMAV_ONLY) find_package(CURL REQUIRED) - if(APPLE) - find_library(APPLE_CORE_FOUNDATION CoreFoundation) - if (NOT APPLE_CORE_FOUNDATION) - message(FATAL_ERROR "Apple CoreFoundation framework not found") - endif() - find_library(APPLE_SECURITY Security) - if (NOT APPLE_SECURITY) - message(FATAL_ERROR "Apple Security framework not found") - endif() - endif() - if(ENABLE_APP) find_package(CURSES REQUIRED) diff --git a/libclamav/CMakeLists.txt b/libclamav/CMakeLists.txt index 9b3aed89eb..d20bf71f5b 100644 --- a/libclamav/CMakeLists.txt +++ b/libclamav/CMakeLists.txt @@ -450,6 +450,13 @@ if(ENABLE_SHARED_LIB) ${CMAKE_DL_LIBS} m ) endif() + + if(APPLE) + target_link_libraries( clamav + PUBLIC + ${APPLE_CORE_FOUNDATION} ) + endif() + set_target_properties( clamav PROPERTIES COMPILE_FLAGS "${WARNCFLAGS}" VERSION ${LIBCLAMAV_VERSION} SOVERSION ${LIBCLAMAV_SOVERSION} ) @@ -549,6 +556,7 @@ if(ENABLE_STATIC_LIB) if (ENABLE_UNRAR) target_link_libraries( clamav_static PUBLIC ClamAV::libunrar_iface_static ClamAV::libunrar_iface_iface) endif() + if (WIN32) target_link_libraries( clamav_static PUBLIC @@ -563,6 +571,13 @@ if(ENABLE_STATIC_LIB) ${CMAKE_DL_LIBS} m ) endif() + + if(APPLE) + target_link_libraries( clamav_static + PUBLIC + ${APPLE_CORE_FOUNDATION} ) + endif() + set_target_properties( clamav_static PROPERTIES ARCHIVE_OUTPUT_NAME clamav_static COMPILE_FLAGS "${WARNCFLAGS}"