[PATCH] D24869: [cfe] [test] Fix detecting LLVM zlib support in stand-alone builds

Michał Górny via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 23 08:43:00 PDT 2016

mgorny created this revision.
mgorny added reviewers: rsmith, beanz, samsonov.
mgorny added a subscriber: cfe-commits.
Herald added subscribers: mgorny, beanz.

Fix the test run to declare missing HAVE_LIBZ value in stand-alone builds, using the LLVM_ENABLE_ZLIB that is exported in LLVMConfig.cmake.

When using in-tree builds, HAVE_LIBZ is declared in cmake/config-ix.cmake as a result of LLVM's CMake checks. When building stand-alone, this value is not available and as a result caused clang to wrongly assume that LLVM was built without zlib support.

To fix it, set it to the value of LLVM_ENABLE_ZLIB. While this variable is originally used to control the user preference, LLVM updates its value to 0 if zlib checks fail. Therefore, we can use it to reliably determine whether LLVM was built with zlib support or not.



Index: test/CMakeLists.txt
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -9,6 +9,15 @@
+  # Set HAVE_LIBZ according to recorded LLVM_ENABLE_ZLIB value. This
+  # value is forced to 0 if zlib was not found, so it is fine to use it
+  # instead of HAVE_LIBZ (not recorded).
+    set(HAVE_LIBZ 1)
+  endif()

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24869.72258.patch
Type: text/x-patch
Size: 663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160923/bc7bbde2/attachment-0001.bin>

More information about the cfe-commits mailing list