[PATCH] D76110: CMake: Turn LLVM_ENABLE_ZLIB into a tri-state option

Amy Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 12 16:51:13 PDT 2020


akhuang created this revision.
akhuang added reviewers: hans, thakis, rnk.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76110

Files:
  llvm/CMakeLists.txt
  llvm/cmake/config-ix.cmake


Index: llvm/cmake/config-ix.cmake
===================================================================
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -175,6 +175,10 @@
   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)
Index: llvm/CMakeLists.txt
===================================================================
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -347,7 +347,7 @@
 
 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.")
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76110.250087.patch
Type: text/x-patch
Size: 980 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200312/f6a81ee6/attachment.bin>


More information about the llvm-commits mailing list