2022-10-22 18:41:00 +08:00
|
|
|
# Copyright (C) 2020-2022 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
add_definitions(-DWIN32_LEAN_AND_MEAN)
|
2023-01-14 18:28:39 +08:00
|
|
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
|
|
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
|
|
|
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
|
2022-10-22 18:41:00 +08:00
|
|
|
|
|
|
|
# Windows compatibility headers
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/win32/compat)
|
|
|
|
endif()
|
|
|
|
|
2023-01-14 18:28:39 +08:00
|
|
|
# The "common" static library.
|
|
|
|
add_library( common STATIC )
|
|
|
|
target_sources( common
|
2022-10-22 18:41:00 +08:00
|
|
|
PRIVATE
|
|
|
|
cert_util.c
|
|
|
|
actions.c
|
|
|
|
clamdcom.c
|
|
|
|
getopt.c
|
|
|
|
hostid.c
|
|
|
|
idmef_logging.c
|
|
|
|
misc.c
|
|
|
|
optparser.c
|
|
|
|
output.c
|
|
|
|
tar.c
|
|
|
|
PUBLIC
|
|
|
|
cert_util.h
|
|
|
|
actions.h
|
|
|
|
clamdcom.h
|
|
|
|
fdpassing.h
|
|
|
|
getopt.h
|
|
|
|
hostid.h
|
|
|
|
idmef_logging.h
|
|
|
|
misc.h
|
|
|
|
optparser.h
|
|
|
|
output.h
|
|
|
|
tar.h )
|
2023-01-14 18:28:39 +08:00
|
|
|
|
|
|
|
target_include_directories( common
|
2022-10-22 18:41:00 +08:00
|
|
|
PRIVATE ${CMAKE_BINARY_DIR}
|
|
|
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} )
|
|
|
|
if(FOUND_SYSTEMD)
|
2023-01-14 18:28:39 +08:00
|
|
|
target_include_directories( common
|
2022-10-22 18:41:00 +08:00
|
|
|
PRIVATE ${SYSTEMD_INCLUDE_DIRS} )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(APPLE)
|
2023-01-14 18:28:39 +08:00
|
|
|
target_sources( common PRIVATE mac/cert_util_mac.m )
|
2022-10-22 18:41:00 +08:00
|
|
|
elseif(WIN32)
|
2023-01-14 18:28:39 +08:00
|
|
|
target_sources( common
|
|
|
|
PRIVATE service.c scanmem.c exescanner.c
|
|
|
|
PUBLIC service.h scanmem.h exescanner.h )
|
|
|
|
target_sources( common PRIVATE win/cert_util_win.c )
|
2022-10-22 18:41:00 +08:00
|
|
|
else()
|
2023-01-14 18:28:39 +08:00
|
|
|
target_sources( common PRIVATE linux/cert_util_linux.c )
|
2022-10-22 18:41:00 +08:00
|
|
|
endif()
|
|
|
|
|
2023-01-14 18:28:39 +08:00
|
|
|
target_link_libraries( common
|
2022-10-22 18:41:00 +08:00
|
|
|
PUBLIC
|
|
|
|
ClamAV::libclamav
|
|
|
|
ZLIB::ZLIB
|
|
|
|
CURL::libcurl
|
|
|
|
OpenSSL::SSL
|
|
|
|
OpenSSL::Crypto )
|
|
|
|
if(WIN32)
|
2023-01-14 18:28:39 +08:00
|
|
|
target_link_libraries( common
|
2022-10-22 18:41:00 +08:00
|
|
|
PUBLIC
|
2023-01-14 18:28:39 +08:00
|
|
|
crypt32
|
|
|
|
psapi)
|
2022-10-22 18:41:00 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(HAVE_SYSTEMD)
|
2023-01-14 18:28:39 +08:00
|
|
|
target_link_libraries( common
|
2022-10-22 18:41:00 +08:00
|
|
|
PRIVATE
|
|
|
|
SYSTEMD::systemd )
|
|
|
|
endif()
|
|
|
|
|
2023-01-14 18:28:39 +08:00
|
|
|
set_target_properties( common PROPERTIES COMPILE_FLAGS "${WARNCFLAGS}" )
|
2022-10-22 18:41:00 +08:00
|
|
|
if(WIN32)
|
2023-01-14 18:28:39 +08:00
|
|
|
set_target_properties(common PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
2022-10-22 18:41:00 +08:00
|
|
|
endif()
|
|
|
|
|
2023-01-14 18:28:39 +08:00
|
|
|
add_library( ClamAV::common ALIAS common )
|