mirror of
https://github.com/Cisco-Talos/clamav.git
synced 2025-10-19 10:23:17 +00:00

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.
148 lines
3.8 KiB
CMake
148 lines
3.8 KiB
CMake
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
|
|
#[=======================================================================[.rst:
|
|
FindCURSES
|
|
-------
|
|
|
|
Finds the CURSES library.
|
|
|
|
Imported Targets
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
This module provides the following imported targets, if found:
|
|
|
|
``Curses::curses``
|
|
The CURSES library
|
|
|
|
Result Variables
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
This will define the following variables:
|
|
|
|
``CURSES_FOUND``
|
|
True if the system has the CURSES library.
|
|
``CURSES_VERSION``
|
|
The version of the CURSES library which was found.
|
|
``CURSES_INCLUDE_DIRS``
|
|
Include directories needed to use CURSES.
|
|
``CURSES_LIBRARIES``
|
|
Libraries needed to link to CURSES.
|
|
|
|
Cache Variables
|
|
^^^^^^^^^^^^^^^
|
|
|
|
The following cache variables may also be set:
|
|
|
|
``CURSES_INCLUDE_DIR``
|
|
The directory containing ``foo.h``.
|
|
``CURSES_LIBRARY``
|
|
The path to the CURSES library.
|
|
|
|
#]=======================================================================]
|
|
|
|
find_package(PkgConfig QUIET)
|
|
# First try for NCurses
|
|
pkg_check_modules(PC_NCurses QUIET ncurses)
|
|
|
|
find_path(NCURSES_INCLUDE_DIR
|
|
NAMES ncurses.h
|
|
PATHS ${PC_NCurses_INCLUDE_DIRS} ${CURSES_INCLUDE_DIR}
|
|
)
|
|
|
|
string(FIND ${NCURSES_INCLUDE_DIR} "-NOTFOUND" NCURSES_NOT_FOUND)
|
|
if(NCURSES_NOT_FOUND EQUAL -1)
|
|
#
|
|
# ncurses WAS found!
|
|
#
|
|
set(HAVE_LIBNCURSES 1)
|
|
set(CURSES_INCLUDE "<ncurses.h>")
|
|
|
|
find_library(CURSES_LIBRARY
|
|
NAMES ncurses
|
|
PATHS ${PC_NCurses_LIBRARY_DIRS}
|
|
)
|
|
|
|
set(CURSES_VERSION ${PC_NCurses_VERSION})
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
find_package_handle_standard_args(CURSES
|
|
FOUND_VAR CURSES_FOUND
|
|
REQUIRED_VARS
|
|
CURSES_LIBRARY
|
|
NCURSES_INCLUDE_DIR
|
|
VERSION_VAR CURSES_VERSION
|
|
)
|
|
|
|
set(HAVE_LIBNCURSES 1)
|
|
set(CURSES_INCLUDE "<ncurses.h>")
|
|
|
|
set(CURSES_LIBRARIES ${CURSES_LIBRARY})
|
|
set(CURSES_INCLUDE_DIRS ${NCURSES_INCLUDE_DIR})
|
|
set(CURSES_DEFINITIONS ${PC_NCurses_CFLAGS_OTHER})
|
|
|
|
if (NOT TARGET Curses::curses)
|
|
add_library(Curses::curses INTERFACE IMPORTED)
|
|
set_target_properties(Curses::curses PROPERTIES
|
|
INTERFACE_COMPILE_OPTIONS "${PC_NCurses_CFLAGS_OTHER}"
|
|
INTERFACE_INCLUDE_DIRECTORIES "${CURSES_INCLUDE_DIR}"
|
|
INTERFACE_LINK_LIBRARIES "${CURSES_LIBRARY}"
|
|
)
|
|
endif()
|
|
else()
|
|
# Try for PDCurses
|
|
pkg_check_modules(PC_PDCurses QUIET curses)
|
|
|
|
find_path(PDCURSES_INCLUDE_DIR
|
|
NAMES curses.h
|
|
PATHS ${PC_PDCurses_INCLUDE_DIRS} ${CURSES_INCLUDE_DIR}
|
|
)
|
|
|
|
string(FIND ${PDCURSES_INCLUDE_DIR} "-NOTFOUND" PDCURSES_NOT_FOUND)
|
|
if(PDCURSES_NOT_FOUND EQUAL -1)
|
|
#
|
|
# pdcurses WAS found!
|
|
#
|
|
set(HAVE_LIBPDCURSES 1)
|
|
set(CURSES_INCLUDE "<curses.h>")
|
|
|
|
find_library(CURSES_LIBRARY
|
|
NAMES curses pdcurses
|
|
PATHS ${PC_PDCurses_LIBRARY_DIRS}
|
|
)
|
|
|
|
set(CURSES_VERSION ${PC_PDCurses_VERSION})
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
find_package_handle_standard_args(CURSES
|
|
FOUND_VAR CURSES_FOUND
|
|
REQUIRED_VARS
|
|
CURSES_LIBRARY
|
|
PDCURSES_INCLUDE_DIR
|
|
VERSION_VAR CURSES_VERSION
|
|
)
|
|
|
|
set(HAVE_LIBPDCURSES 1)
|
|
set(CURSES_INCLUDE "<curses.h>")
|
|
|
|
set(CURSES_LIBRARIES ${CURSES_LIBRARY})
|
|
set(CURSES_INCLUDE_DIRS ${PDCURSES_INCLUDE_DIR})
|
|
set(CURSES_DEFINITIONS ${PC_PDCurses_CFLAGS_OTHER})
|
|
|
|
if (NOT TARGET Curses::curses)
|
|
add_library(Curses::curses UNKNOWN IMPORTED)
|
|
set_target_properties(Curses::curses PROPERTIES
|
|
INTERFACE_COMPILE_OPTIONS "${PC_PDCurses_CFLAGS_OTHER}"
|
|
INTERFACE_INCLUDE_DIRECTORIES "${CURSES_INCLUDE_DIR}"
|
|
IMPORTED_LOCATION "${CURSES_LIBRARY}"
|
|
)
|
|
endif()
|
|
else()
|
|
message(FATAL_ERROR "Unable to find ncurses or pdcurses")
|
|
endif()
|
|
endif()
|
|
|
|
mark_as_advanced(
|
|
CURSES_INCLUDE_DIR
|
|
CURSES_LIBRARY
|
|
)
|