clamav/CMakeOptions.cmake
Micah Snyder c81968d3a7 GitHub Actions testing on Ubuntu, Mac, & Windows
Updates to fix issues in the CMake install instructions.

Updates the README.md to indicate that CMake is now preferred

Adds a GitHub Actions badge, Discord badge, and logo to the README.md.

CMake:

- Renamed ENABLE_DOCS to ENABLE_MAN_PAGES.

- Fixed build issue when milter isn't enabled on Linux. Changed the
default to build milter on non-macOS, non-Windows operating systems.

- Fix LD_LIBRARY_PATH for tests including on macOS where LD_LIBRARY_PATH
  and DYLD_LIBRARY_PATH must be manually propagated to subprocesses.

- Use UNKNOWN IMPORTED library instead of INTERFACE IMPORTED library for
  pdcurses, but still use INTERFACE IMPORTED for ncurses.
  UNKNOWN IMPORTED appears to be required so that we can use
  $<TARGET_FILE_DIR:Curses::curses> to collected the pdcurses library at
  install time on Windows.

- When building with vcpkg on Windows, CMake will automatically install
  your app local dependencies (aka the DLL runtime dependencies).
  Meanwhile, file(GET_RUNTIME_DEPENDENCIES ...) doesn't appear to work
  correctly with vcpkg packages. The solution is to use a custom target
  that has CMake perform a local install to the unit_tests directory
  when using vcpkg.
  This is in fact far easier than using GET_RUNTIME_DEPENDENCIES in the
  unit_tests for assembling the test environment but we can't use this
  method for the non-vcpkg install because it won't collect
  checkDynamic.dll for us because we don't install our tests.
  We also can't link with the static check.lib because the static
  check.lib has pthreads symbols linked in and will conflict with our
  pthread.dll.

  TL;DR: We'll continue to use file(GET_RUNTIME_DEPENDENCIES ...) for
  assembling the test enviornment on non-vcpkg builds, and use the local
  install method for vcpkg builds.

testcase.py: Wrapped a Pathlib.unlink() call in exception handling as
the missing_ok optional parameter requires a Python version too new for
common use.

Remove localtime_r from win32 compat lib.
localtime_r may be present in libcheck when building with vcpkg and
while making it a static function would also solve the issue, using
localtime_s instead like we do everywhere else should work just fine.

check_clamd: Limited the max # of connections for the stress test on Mac
to 850, to address issues found testing on macos-latest on GitHub Actions.
2021-02-25 11:41:28 -08:00

112 lines
3 KiB
CMake

# Features that can be enabled for cmake (see CMakeLists.txt)
if(WIN32)
set(APP_CONFIG_DIRECTORY
"." CACHE STRING
"App Config directory.")
set(DATABASE_DIRECTORY
"database" CACHE STRING
"Database directory.")
else()
set(APP_CONFIG_DIRECTORY
"etc" CACHE STRING
"App Config directory.")
set(DATABASE_DIRECTORY
"share/clamav" CACHE STRING
"Database directory.")
endif()
set(CLAMAV_USER "clamav" CACHE STRING "ClamAV User")
set(CLAMAV_GROUP "clamav" CACHE STRING "ClamAV Group")
set(MMAP_FOR_CROSSCOMPILING
0 CACHE STRING
"Force MMAP support for cross-compiling.")
set(DISABLE_MPOOL
0 CACHE STRING
"Disable mpool support entirely.")
set(BYTECODE_RUNTIME
"interpreter" CACHE STRING
"Bytecode Runtime, may be: 'llvm', 'interpreter', 'none'.")
option(OPTIMIZE
"Allow compiler optimizations. Set to OFF to disable (i.e. to set -O0)."
ON)
option(ENABLE_WERROR
"Compile time warnings will cause build failures.")
option(ENABLE_ALL_THE_WARNINGS
"Enable as many compiler warnings as possible.")
option(ENABLE_DEBUG
"Turn on extra debug output.")
option(ENABLE_EXPERIMENTAL
"Turn on experimental features (if any).")
option(ENABLE_FRESHCLAM_DNS_FIX
"Enable workaround for broken DNS servers.")
option(ENABLE_FRESHCLAM_NO_CACHE
"Use 'Cache-Control: no-cache' in freshclam.")
option(ENABLE_STRN_INTERNAL
"Enables explicit use of internal strn functions to support cross-compilation against older libs.")
option(ENABLE_FUZZ
"Build fuzz targets. Will enable ENABLE_STATIC_LIB for you.")
option(ENABLE_EXTERNAL_MSPACK
"Use external mspack instead of internal libclammspack.")
option(ENABLE_JSON_SHARED
"Prefer linking with libjson-c shared library instead of static."
ON)
option(ENABLE_APP
"Build applications (clamscan, clamd, clamdscan, clamonacc, sigtool, clambc, clamav-milter, clamdtop, clamsubmit, clamconf)."
${ENABLE_APP_DEFAULT})
option(ENABLE_MILTER
"Build clamav-milter (requires ENABLE_APP))."
${ENABLE_MILTER_DEFAULT})
option(ENABLE_CLAMONACC
"Build clamonacc (Linux-only, requires ENABLE_APP))."
${ENABLE_CLAMONACC_DEFAULT})
option(ENABLE_MAN_PAGES
"Generate man pages."
${ENABLE_MAN_PAGES_DEFAULT})
option(ENABLE_DOXYGEN
"Generate doxygen HTML documentation for clamav.h, libfreshclam.h."
${ENABLE_DOXYGEN_DEFAULT})
option(ENABLE_EXAMPLES
"Build examples."
${ENABLE_EXAMPLES_DEFAULT})
option(ENABLE_TESTS
"Build/enable unit tests."
${ENABLE_TESTS_DEFAULT})
option(ENABLE_LIBCLAMAV_ONLY
"Build libclamav only. Excludes libfreshclam too!")
option(ENABLE_STATIC_LIB
"Build libclamav and/or libfreshclam static libraries.")
option(ENABLE_SHARED_LIB
"Build libclamav and/or libfreshclam shared libraries."
ON)
option(ENABLE_UNRAR
"Build & install libclamunrar."
${ENABLE_UNRAR_DEFAULT})
option(ENABLE_SYSTEMD
"Install systemd service files if systemd is found."
${ENABLE_SYSTEMD_DEFAULT})