Skip to content

Commit

Permalink
CMake: Turn LLVM_ENABLE_ZLIB into a tri-state option
Browse files Browse the repository at this point in the history
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
  • Loading branch information
amykhuang committed Mar 13, 2020
1 parent c6f1713 commit 9a349d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/CMakeLists.txt
Expand Up @@ -348,7 +348,7 @@ option(LLVM_ENABLE_LIBPFM "Use libpfm for performance counters if available." ON

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

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

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

Expand Down
4 changes: 4 additions & 0 deletions llvm/cmake/config-ix.cmake
Expand Up @@ -175,6 +175,10 @@ if (LLVM_ENABLE_LIBXML2 STREQUAL "FORCE_ON" AND NOT LLVM_LIBXML2_ENABLED)
message(FATAL_ERROR "Failed to congifure libxml2")
endif()

if (LLVM_ENABLE_ZLIB STREQUAL "FORCE_ON" AND NOT HAVE_LIBZ)
message(FATAL_ERROR "Failed to configure zlib")
endif()

check_library_exists(xar xar_open "" HAVE_LIBXAR)
if(HAVE_LIBXAR)
set(XAR_LIB xar)
Expand Down

0 comments on commit 9a349d6

Please sign in to comment.