diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2020-01-01 16:57:00 -0800 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2020-01-01 17:02:16 -0800 |
commit | e6c7ed6d2164a0659fd9f6ee44f1375d301e3cad (patch) | |
tree | cbd6317d1a64777c56bf1a7bdba9c516b314662e /llvm/cmake/config-ix.cmake | |
parent | 68a235d07f9e7049c7eb0c8091f37e385327ac28 (diff) | |
download | bcm5719-llvm-e6c7ed6d2164a0659fd9f6ee44f1375d301e3cad.tar.gz bcm5719-llvm-e6c7ed6d2164a0659fd9f6ee44f1375d301e3cad.zip |
build: make `LLVM_ENABLE_ZLIB` a tri-bool for users
Treat the flag `LLVM_ENABLE_ZLIB` as a tri-bool, `FORCE_ON` being `ON`,
and `ON` being an auto-detect. This is needed as many of the builders
enable the flag without having zlib available.
Diffstat (limited to 'llvm/cmake/config-ix.cmake')
-rw-r--r-- | llvm/cmake/config-ix.cmake | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index d5a15a680a6..a16038f7098 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -117,10 +117,6 @@ endif() # Don't look for these libraries if we're using MSan, since uninstrumented third # party code may call MSan interceptors like strlen, leading to false positives. if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*") - if(LLVM_ENABLE_ZLIB) - find_package(ZLIB REQUIRED) - endif() - # Don't look for these libraries on Windows. if (NOT PURE_WINDOWS) # Skip libedit if using ASan as it contains memory leaks. @@ -506,7 +502,21 @@ else( LLVM_ENABLE_THREADS ) endif() if(LLVM_ENABLE_ZLIB) - find_package(ZLIB REQUIRED) + if(LLVM_ENABLE_ZLIB STREQUAL FORCE_ON) + find_package(ZLIB REQUIRED) + else() + find_package(ZLIB) + endif() + + if(ZLIB_FOUND) + set(LLVM_ENABLE_ZLIB "YES" CACHE STRING + "Use zlib for compression/decompression if available. Can be ON, OFF, or FORCE_ON" + FORCE) + else() + set(LLVM_ENABLE_ZLIB "NO" CACHE STRING + "Use zlib for compression/decompression if available. Can be ON, OFF, or FORCE_ON" + FORCE) + endif() endif() if (LLVM_ENABLE_DOXYGEN) |