Skip to content

[CMake] Fix config when static zstd libraries are not found #113584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion llvm/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
@@ -195,8 +195,19 @@ if(LLVM_ENABLE_ZSTD)
elseif(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
find_package(zstd QUIET)
endif()

# If LLVM_USE_STATIC_ZSTD is specified, make sure we enable zstd only if static
# libraries are found.
if(LLVM_USE_STATIC_ZSTD AND NOT TARGET zstd::libzstd_static)
# Fail if LLVM_ENABLE_ZSTD is FORCE_ON.
if(LLVM_ENABLE_ZSTD STREQUAL FORCE_ON)
message(FATAL_ERROR "Failed to find static zstd libraries, but LLVM_USE_STATIC_ZSTD=ON and LLVM_ENABLE_ZSTD=FORCE_ON.")
endif()
set(LLVM_ENABLE_ZSTD OFF)
else()
set(LLVM_ENABLE_ZSTD ${zstd_FOUND})
endif()
endif()
set(LLVM_ENABLE_ZSTD ${zstd_FOUND})

if(LLVM_ENABLE_LIBXML2)
if(LLVM_ENABLE_LIBXML2 STREQUAL FORCE_ON)
Loading
Oops, something went wrong.