e4f0680c4a
Upstream's cmake build system installs libzstd_static for static builds, so look for that as well. Now we can also recommend installing it via vcpkg. Change-Id: I0ba4c45ecd90bf7b1c9f1e5f84a440caa976a23c Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
51 lines
1.3 KiB
CMake
51 lines
1.3 KiB
CMake
#.rst:
|
|
# FindZstd
|
|
# ---------
|
|
#
|
|
# Try to locate the Zstd library.
|
|
# If found, this will define the following variables:
|
|
#
|
|
# ``ZSTD_FOUND``
|
|
# True if the zstd library is available
|
|
# ``ZSTD_INCLUDE_DIRS``
|
|
# The zstd include directories
|
|
# ``ZSTD_LIBRARIES``
|
|
# The zstd libraries for linking
|
|
#
|
|
# If ``ZSTD_FOUND`` is TRUE, it will also define the following
|
|
# imported target:
|
|
#
|
|
# ``ZSTD::ZSTD``
|
|
# The zstd library
|
|
|
|
find_package(PkgConfig)
|
|
pkg_check_modules(PC_ZSTD QUIET libzstd)
|
|
|
|
find_path(ZSTD_INCLUDE_DIRS
|
|
NAMES zstd.h
|
|
HINTS ${PC_ZSTD_INCLUDEDIR}
|
|
PATH_SUFFIXES zstd)
|
|
|
|
find_library(ZSTD_LIBRARIES
|
|
NAMES zstd zstd_static
|
|
HINTS ${PC_ZSTD_LIBDIR}
|
|
)
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
find_package_handle_standard_args(ZSTD DEFAULT_MSG ZSTD_LIBRARIES ZSTD_INCLUDE_DIRS)
|
|
|
|
if(ZSTD_FOUND AND NOT TARGET ZSTD::ZSTD)
|
|
add_library(ZSTD::ZSTD UNKNOWN IMPORTED)
|
|
set_target_properties(ZSTD::ZSTD PROPERTIES
|
|
IMPORTED_LOCATION "${ZSTD_LIBRARIES}"
|
|
INTERFACE_INCLUDE_DIRECTORIES "${ZSTD_INCLUDE_DIRS}")
|
|
endif()
|
|
|
|
mark_as_advanced(ZSTD_INCLUDE_DIRS ZSTD_LIBRARIES)
|
|
|
|
include(FeatureSummary)
|
|
set_package_properties(ZSTD PROPERTIES
|
|
URL "https://github.com/facebook/zstd"
|
|
DESCRIPTION "ZSTD compression library")
|
|
|