1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
Author: Pino Toscano <pino@debian.org>
Description: Look for zstd before Clang
The story is more or less the following:
- LLVM ships its own Findzstd cmake find module from 16; this module defines
2 targets: zstd::libzstd_shared and zstd::libzstd_static
- libzstd ships a cmake config module that defines 3 targets:
zstd::libzstd_shared, zstd::libzstd_static, and zstd::libzstd
- the libzstd config module assumes that if one target is defined, all of them
are, as if the config module itself was already run (i.e. multiple
"find_package(zstd)" in a cmake project)
- in qttools, Clang is searched first, which in turns requires LLVM, and then
libzstd
.
More details here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1073480#47
.
As workaround, look for libzstd before Clang: this way the proper zstd cmake
targets are defined, and the Findzstd cmake find module shipped with LLVM will
use them just fine without redefining them.
.
This should most likely be fixed on LLVM side.
Last-Update: 2025-07-19
Forwarded: not-needed
--- a/configure.cmake
+++ b/configure.cmake
@@ -3,6 +3,19 @@
#### Tests
+# HACK: look for libzstd before Clang/LLVM; this way all the right
+# libzstd cmake targets are defined, instead of the partial ones defined
+# by the Findzstd shipped with LLVM
+if(NOT TARGET WrapZSTD::WrapZSTD)
+ qt_find_package(WrapZSTD 1.3
+ PROVIDED_TARGETS
+ WrapZSTD::WrapZSTD
+ zstd::libzstd
+ zstd::libzstd_static
+ zstd::libzstd_shared
+ )
+endif()
+
qt_find_package(WrapLibClang 8 PROVIDED_TARGETS WrapLibClang::WrapLibClang)
if(TARGET WrapLibClang::WrapLibClang)
--- a/src/designer/src/lib/CMakeLists.txt
+++ b/src/designer/src/lib/CMakeLists.txt
@@ -420,15 +420,6 @@ endif()
if(TARGET zstd::libzstd_static)
qt_internal_disable_find_package_global_promotion(zstd::libzstd_static)
endif()
-if(NOT TARGET WrapZSTD::WrapZSTD)
- qt_find_package(WrapZSTD 1.3
- PROVIDED_TARGETS
- WrapZSTD::WrapZSTD
- zstd::libzstd
- zstd::libzstd_static
- zstd::libzstd_shared
- )
-endif()
qt_internal_extend_target(Designer CONDITION QT_FEATURE_zstd
LIBRARIES
|