ladybird/Meta/CMake/clang_development.cmake
Rocco Corsi f95320af0b 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
2026-02-19 20:03:41 +01:00

21 lines
789 B
CMake

#
# Finds clang and llvm development packages that match the current clang version
#
if (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
return()
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)