Files
clamav/clamdtop/CMakeLists.txt
T
Micah Snyder 6b3b8b2e9d CMake: CPack generate Windows installer with WIX
Also creates a ZIP for non-Admin (per-user) installs.

WIX requires the license file to have a .txt or .rtf extension so I
added the .txt extension. I've taken the opportunity to migrate the 3rd
party licenses to a COPYING subdirectory and have added licensing
details to the README.md file.

To build the installer, install WIX and simply run `cpack -C Release`

Also removed the explicit --config option from the
clamav-clamonacc.service file because it should not be required and
isn't being generated correctly when using autotools anyways, especially
after changes in this commit.
2021-02-25 11:41:27 -08:00

59 lines
1.8 KiB
CMake

# Copyright (C) 2020 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
if(WIN32)
add_definitions(-DWIN32_LEAN_AND_MEAN)
add_definitions(-DHAVE_STRUCT_TIMESPEC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
# Windows compatibility headers
include_directories(${CMAKE_SOURCE_DIR}/win32/compat)
endif()
# The clamdtop executable.
add_executable( clamdtop )
target_sources( clamdtop
PRIVATE
clamdtop.c )
if(WIN32)
target_sources( clamdtop PRIVATE ${CMAKE_SOURCE_DIR}/win32/res/clamdtop.rc )
endif()
target_include_directories( clamdtop
PRIVATE ${CMAKE_BINARY_DIR} # For clamav-config.h
)
set_target_properties( clamdtop PROPERTIES COMPILE_FLAGS "${WARNCFLAGS}" )
target_link_libraries( clamdtop
PRIVATE
ClamAV::libclamav
ClamAV::shared
Curses::curses )
if(WIN32)
install(TARGETS clamdtop DESTINATION .)
# Also install shared library (DLL) dependencies
install(CODE [[
file(GET_RUNTIME_DEPENDENCIES
EXECUTABLES
$<TARGET_FILE:clamdtop>
RESOLVED_DEPENDENCIES_VAR _r_deps
UNRESOLVED_DEPENDENCIES_VAR _u_deps
DIRECTORIES
$<TARGET_FILE_DIR:Curses::curses>
)
foreach(_file ${_r_deps})
string(TOLOWER ${_file} _file_lower)
if(NOT ${_file_lower} MATCHES "c:[\\/]windows[\\/]system32.*")
file(INSTALL
DESTINATION "${CMAKE_INSTALL_PREFIX}"
TYPE SHARED_LIBRARY
FOLLOW_SYMLINK_CHAIN
FILES "${_file}"
)
endif()
endforeach()
#message("UNRESOLVED_DEPENDENCIES_VAR: ${_u_deps}")
]])
else()
install(TARGETS clamdtop DESTINATION bin)
endif()