CMake: Make zstd config-based lookup quiet

Make zstd config based lookup quiet and check for version variable
as required for ZSTD target.

Add IMPORTED_LOCATION by default for pkg-config based search.
Expect that select_library_configurations will set correct value
for ZSTD_LIBRARY.

Fixes: QTBUG-88091
Change-Id: Ia5079154ce4fc4eefbc0931317219b5ca0f3f82f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2020-11-09 16:06:57 +01:00
parent 76230d9879
commit a1ce164d74

View File

@ -18,12 +18,12 @@
# ``ZSTD::ZSTD``
# The zstd library
find_package(zstd CONFIG)
find_package(zstd CONFIG QUIET)
include(FindPackageHandleStandardArgs)
if(TARGET zstd::libzstd_static OR TARGET zstd::libzstd_shared)
find_package_handle_standard_args(ZSTD REQUIRED_VARS zstd_DIR VERSION_VAR zstd_VERSION)
find_package_handle_standard_args(ZSTD REQUIRED_VARS zstd_VERSION VERSION_VAR zstd_VERSION)
if(TARGET zstd::libzstd_static)
set(zstdtargetsuffix "_static")
else()
@ -62,6 +62,8 @@ else()
add_library(ZSTD::ZSTD UNKNOWN IMPORTED)
set_target_properties(ZSTD::ZSTD PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${ZSTD_INCLUDE_DIRS}")
set_target_properties(ZSTD::ZSTD PROPERTIES
IMPORTED_LOCATION "${ZSTD_LIBRARY}")
if(ZSTD_LIBRARY_RELEASE)
set_target_properties(ZSTD::ZSTD PROPERTIES
IMPORTED_LOCATION_RELEASE "${ZSTD_LIBRARY_RELEASE}")