diff --git a/CMakeLists.txt b/CMakeLists.txt index dc98a34..c4d1527 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,12 +5,22 @@ project(solanaceae_clamav) if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) set(SOLANACEAE_CLAMAV_STANDALONE ON) + # why the f do i need this >:( + set(NOT_SOLANACEAE_CLAMAV_STANDALONE OFF) else() set(SOLANACEAE_CLAMAV_STANDALONE OFF) + set(NOT_SOLANACEAE_CLAMAV_STANDALONE ON) endif() message("II SOLANACEAE_CLAMAV_STANDALONE " ${SOLANACEAE_CLAMAV_STANDALONE}) -option(SOLANACEAE_CLAMAV_BUILD_PLUGINS "Build the clamav plugins" ${SOLANACEAE_CLAMAV_STANDALONE}) +option(SOLANACEAE_CLAMAV_INTERFACE_ONLY + "Only provide the interfaces. (effectively disabled external depencencies)" + ${NOT_SOLANACEAE_CLAMAV_STANDALONE} +) +option(SOLANACEAE_CLAMAV_BUILD_PLUGINS + "Build the clamav plugins" + ${SOLANACEAE_CLAMAV_STANDALONE} +) if (SOLANACEAE_CLAMAV_STANDALONE) set(CMAKE_POSITION_INDEPENDENT_CODE ON) @@ -30,7 +40,9 @@ if (SOLANACEAE_CLAMAV_STANDALONE) endif() # external libs -add_subdirectory(./external) # before increasing warn levels, sad :( +if (NOT SOLANACEAE_CLAMAV_INTERFACE_ONLY) + add_subdirectory(./external) # before increasing warn levels, sad :( +endif() if (SOLANACEAE_CLAMAV_STANDALONE) @@ -65,7 +77,7 @@ endif() add_subdirectory(./src) -if (SOLANACEAE_CLAMAV_BUILD_PLUGINS) +if (NOT SOLANACEAE_CLAMAV_INTERFACE_ONLY AND SOLANACEAE_CLAMAV_BUILD_PLUGINS) add_subdirectory(./plugins) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dbe79f1..a2ee32a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.24 FATAL_ERROR) + + add_library(solanaceae_clamav_interface INTERFACE ./solanaceae/clamav/clamav_module_interface.hpp ) @@ -8,20 +10,6 @@ target_compile_features(solanaceae_clamav_interface INTERFACE cxx_std_17) ######################################## -add_library(solanaceae_clamav - ./solanaceae/clamav/clamav_module.hpp - ./solanaceae/clamav/clamav_module.cpp -) -target_include_directories(solanaceae_clamav PUBLIC .) -target_compile_features(solanaceae_clamav PUBLIC cxx_std_17) -target_link_libraries(solanaceae_clamav PUBLIC - solanaceae_clamav_interface - EXT_SOL::libclamav - solanaceae_util -) - -######################################## - add_library(solanaceae_clamav_async_interface INTERFACE ./solanaceae/clamav/clamav_module_async_interface.hpp ) @@ -30,28 +18,46 @@ target_compile_features(solanaceae_clamav_async_interface INTERFACE cxx_std_17) ######################################## -add_library(solanaceae_clamav_async_wrapper - ./solanaceae/clamav/clamav_module_async_wrapper.hpp - ./solanaceae/clamav/clamav_module_async_wrapper.cpp -) -target_link_libraries(solanaceae_clamav_async_wrapper PUBLIC - solanaceae_clamav_interface - solanaceae_clamav_async_interface -) +if (NOT ${SOLANACEAE_CLAMAV_INTERFACE_ONLY}) + + add_library(solanaceae_clamav + ./solanaceae/clamav/clamav_module.hpp + ./solanaceae/clamav/clamav_module.cpp + ) + target_include_directories(solanaceae_clamav PUBLIC .) + target_compile_features(solanaceae_clamav PUBLIC cxx_std_17) + target_link_libraries(solanaceae_clamav PUBLIC + solanaceae_clamav_interface + EXT_SOL::libclamav + solanaceae_util + ) ######################################## -if (SOLANACEAE_CLAMAV_STANDALONE) + add_library(solanaceae_clamav_async_wrapper + ./solanaceae/clamav/clamav_module_async_wrapper.hpp + ./solanaceae/clamav/clamav_module_async_wrapper.cpp + ) + target_link_libraries(solanaceae_clamav_async_wrapper PUBLIC + solanaceae_clamav_interface + solanaceae_clamav_async_interface + ) - add_executable(solanaceae_clamav_test - ./solanaceae/clamav/test_exe.cpp - ) - target_include_directories(solanaceae_clamav_test PUBLIC .) - target_compile_features(solanaceae_clamav_test PUBLIC cxx_std_17) - target_link_libraries(solanaceae_clamav_test PUBLIC - solanaceae_clamav - #solanaceae_util - ) + +######################################## + + if (SOLANACEAE_CLAMAV_STANDALONE) + + add_executable(solanaceae_clamav_test + ./solanaceae/clamav/test_exe.cpp + ) + target_include_directories(solanaceae_clamav_test PUBLIC .) + target_compile_features(solanaceae_clamav_test PUBLIC cxx_std_17) + target_link_libraries(solanaceae_clamav_test PUBLIC + solanaceae_clamav + #solanaceae_util + ) + + endif() endif() -