Meta: Build zstd correctly to support clang plugins and curl 8.18.0

clang/llvm is dependent on zstd and its cmake will configure/build zstd
if it is not available. This is especially the case when the clang
plugins libraries are used.

Curl 8.18.0 configure fails if zstd is configured by clang first as not
all the required zstd libraries will be built by clang's cmake.

When testing with clang_plugins enabled the zstd package will be
configured before clang to create all the required libraries avoiding
later cmake issues between curl 8.18.0 and zstd

See https://github.com/llvm/llvm-project/issues/139666
This commit is contained in:
Rocco Corsi 2026-02-16 17:22:55 -05:00 committed by Shannon Booth
parent fd24ca898c
commit f95320af0b

View file

@ -8,5 +8,14 @@ endif()
set(DESIRED_CLANG_VERSION "${CMAKE_CXX_COMPILER_VERSION}")
# find zstd package before clang so that it is built fully and not
# specifically for clang's use. Clang/LLVM requires zstd and it's cmake
# will build zstd if not available, but clang's cmake will incorrectly
# build zstd for curl 8.18.0, which also depends on zstd.
#
# see https://github.com/LadybirdBrowser/ladybird/pull/7738
# related to https://github.com/llvm/llvm-project/issues/139666
find_package(zstd QUIET CONFIG REQUIRED)
find_package(Clang "${DESIRED_CLANG_VERSION}" QUIET REQUIRED CONFIG)
find_package(LLVM "${DESIRED_CLANG_VERSION}" QUIET REQUIRED CONFIG)