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

Add support for compiling with external TomsFastMath library provided by the system instead of compiling the vendored copy into libclamav. The vendored source is still built directly into libclamav instead of as a separate library the way libmspack is done. The rationale is that: A) it's more complicated to deal with possibly compiling as static or dynamic, and also B) libmspack and libunrar are compiled separately primarily because of licensing concerns. TomsFastMath public domain, so that isn't a concern. Resolves: https://bugzilla.clamav.net/show_bug.cgi?id=12562
86 lines
2 KiB
CMake
86 lines
2 KiB
CMake
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
|
|
#[=======================================================================[.rst:
|
|
FindMSPack
|
|
-------
|
|
|
|
Finds the MSPack library.
|
|
|
|
Imported Targets
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
This module provides the following imported targets, if found:
|
|
|
|
``MSPack::mspack``
|
|
The MSPack library
|
|
|
|
Result Variables
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
This will define the following variables:
|
|
|
|
``MSPack_FOUND``
|
|
True if the system has the MSPack library.
|
|
``MSPack_VERSION``
|
|
The version of the MSPack library which was found.
|
|
``MSPack_INCLUDE_DIRS``
|
|
Include directories needed to use MSPack.
|
|
``MSPack_LIBRARIES``
|
|
Libraries needed to link to MSPack.
|
|
|
|
Cache Variables
|
|
^^^^^^^^^^^^^^^
|
|
|
|
The following cache variables may also be set:
|
|
|
|
``MSPack_INCLUDE_DIR``
|
|
The directory containing ``mspack.h``.
|
|
``MSPack_LIBRARY``
|
|
The path to the MSPack library.
|
|
|
|
#]=======================================================================]
|
|
|
|
find_package(PkgConfig QUIET)
|
|
pkg_check_modules(PC_MSPack QUIET mspack)
|
|
|
|
find_path(MSPack_INCLUDE_DIR
|
|
NAMES mspack.h
|
|
PATHS ${PC_MSPack_INCLUDE_DIRS}
|
|
PATH_SUFFIXES mspack
|
|
)
|
|
find_library(MSPack_LIBRARY
|
|
NAMES mspack
|
|
PATHS ${PC_MSPack_LIBRARY_DIRS}
|
|
)
|
|
|
|
set(MSPack_VERSION ${PC_MSPack_VERSION})
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
find_package_handle_standard_args(MSPack
|
|
FOUND_VAR MSPack_FOUND
|
|
REQUIRED_VARS
|
|
MSPack_LIBRARY
|
|
MSPack_INCLUDE_DIR
|
|
VERSION_VAR MSPack_VERSION
|
|
)
|
|
|
|
if(MSPack_FOUND)
|
|
set(MSPack_LIBRARIES ${MSPack_LIBRARY})
|
|
set(MSPack_INCLUDE_DIRS ${MSPack_INCLUDE_DIR})
|
|
set(MSPack_DEFINITIONS ${PC_MSPack_CFLAGS_OTHER})
|
|
endif()
|
|
|
|
if(MSPack_FOUND AND NOT TARGET MSPack::mspack)
|
|
add_library(MSPack::mspack UNKNOWN IMPORTED)
|
|
set_target_properties(MSPack::mspack PROPERTIES
|
|
IMPORTED_LOCATION "${MSPack_LIBRARY}"
|
|
INTERFACE_COMPILE_OPTIONS "${PC_MSPack_CFLAGS_OTHER}"
|
|
INTERFACE_INCLUDE_DIRECTORIES "${MSPack_INCLUDE_DIR}"
|
|
)
|
|
endif()
|
|
|
|
mark_as_advanced(
|
|
MSPack_INCLUDE_DIR
|
|
MSPack_LIBRARY
|
|
)
|