Commit 5384597
committed
Fix libarchive not detecting liblzma and zstd compression support
libarchive's CMakeLists.txt runs CHECK_FUNCTION_EXISTS and
CHECK_C_SOURCE_COMPILES during configure time to detect compression
library features. These checks fail when using CPM-managed dependencies
because the actual library files don't exist yet at configure time
(only the CMake targets exist).
This causes libarchive to be built without LZMA/XZ and Zstandard
support, resulting in errors like:
"Failed to open file: ...json.xz"
"Can't initialize filter; unable to run program xz -d -qq"
Fix by:
1. Setting liblzma_DIR to point to xz's exported CMake config
2. Adding LIBLZMA_INCLUDE_DIRS (plural) which libarchive requires
3. Pre-caching CHECK_* results so configure-time checks are skipped:
- HAVE_LZMA_STREAM_ENCODER_MT=0 (encoder disabled in our build)
- LZMA_API_STATIC=1 (static library)
- HAVE_LIBZSTD=1 (decompressor available)
- HAVE_ZSTD_compressStream=0 (compressor disabled)
- HAVE_ZSTD_minCLevel=0 (compressor disabled)
CMake's CHECK_* macros skip execution when the result variable is
already defined in the cache, allowing us to bypass the compile/link
tests that would otherwise fail.1 parent b3e42ed commit 5384597
1 file changed
+18
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
| 103 | + | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
107 | | - | |
108 | | - | |
| 108 | + | |
| 109 | + | |
109 | 110 | | |
110 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
111 | 117 | | |
112 | 118 | | |
113 | 119 | | |
| |||
149 | 155 | | |
150 | 156 | | |
151 | 157 | | |
152 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
153 | 166 | | |
154 | 167 | | |
155 | 168 | | |
| |||
0 commit comments