Skip to content

Commit 9a349d6

Browse files
committed
CMake: Turn LLVM_ENABLE_ZLIB into a tri-state option
Summary: Add FORCE_ON option to LLVM_ENABLE_ZLIB, which causes a configuration error if zlib is not found. Similar to https://reviews.llvm.org/D40050. Reviewers: hans, thakis, rnk Subscribers: mgorny, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D76110
1 parent c6f1713 commit 9a349d6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

llvm/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ option(LLVM_ENABLE_LIBPFM "Use libpfm for performance counters if available." ON
348348

349349
option(LLVM_ENABLE_THREADS "Use threads if available." ON)
350350

351-
option(LLVM_ENABLE_ZLIB "Use zlib for compression/decompression if available." ON)
351+
set(LLVM_ENABLE_ZLIB "ON" CACHE STRING "Use zlib for compression/decompression if available. Can be ON, OFF, or FORCE_ON")
352352

353353
set(LLVM_Z3_INSTALL_DIR "" CACHE STRING "Install directory of the Z3 solver.")
354354

llvm/cmake/config-ix.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ if (LLVM_ENABLE_LIBXML2 STREQUAL "FORCE_ON" AND NOT LLVM_LIBXML2_ENABLED)
175175
message(FATAL_ERROR "Failed to congifure libxml2")
176176
endif()
177177

178+
if (LLVM_ENABLE_ZLIB STREQUAL "FORCE_ON" AND NOT HAVE_LIBZ)
179+
message(FATAL_ERROR "Failed to configure zlib")
180+
endif()
181+
178182
check_library_exists(xar xar_open "" HAVE_LIBXAR)
179183
if(HAVE_LIBXAR)
180184
set(XAR_LIB xar)

0 commit comments

Comments
 (0)