3c52f8af9d
If certain 3rd party libraries have a version that's not suitable for Qt, the configure summary should say so, rather than use them and fail at build time. With the current situation, we have to duplicate the version information from the configure.json files in helper.py, by assigning the version number as an extra find_package variable. Rerunning configurejson2cmake then embeds this version info into the qt_find_package calls in configure.cmake. Some of the Find modules are rewritten to take the specified version into account when looking for the libraries. This involves moving around the code for creating a target, after calling find_package_handle_standard_args() so we know if a good enough version was found. Task-number: QTBUG-82917 Change-Id: I139748d8090e0630cda413362760034dc3483e11 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
52 lines
1.4 KiB
CMake
52 lines
1.4 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 QUIET)
|
|
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 REQUIRED_VARS ZSTD_LIBRARIES ZSTD_INCLUDE_DIRS
|
|
VERSION_VAR PC_ZSTD_VERSION)
|
|
|
|
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")
|
|
|