[PATCH] D39002: [cmake] Use find_package to discover zlib

Vassil Vassilev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 17 12:15:28 PDT 2017


v.g.vassilev updated this revision to Diff 119368.
v.g.vassilev marked 2 inline comments as done.
v.g.vassilev added a comment.

Address comments.


https://reviews.llvm.org/D39002

Files:
  cmake/config-ix.cmake
  lib/Support/CMakeLists.txt


Index: lib/Support/CMakeLists.txt
===================================================================
--- lib/Support/CMakeLists.txt
+++ lib/Support/CMakeLists.txt
@@ -22,7 +22,7 @@
   endif()
   set(system_libs ${system_libs} ${LLVM_PTHREAD_LIB})
   if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ )
-    set(system_libs ${system_libs} z)
+    set(system_libs ${system_libs} ${ZLIB_LIBRARIES})
   endif()
   if( UNIX AND NOT (BEOS OR HAIKU) )
     set(system_libs ${system_libs} m)
Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -132,7 +132,10 @@
 # like strlen, leading to false positives.
 if( NOT PURE_WINDOWS AND NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
   if (LLVM_ENABLE_ZLIB)
-    check_library_exists(z compress2 "" HAVE_LIBZ)
+    find_package(ZLIB REQUIRED)
+    if (ZLIB_FOUND)
+      set(HAVE_LIBZ 1)
+    endif()
   else()
     set(HAVE_LIBZ 0)
   endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39002.119368.patch
Type: text/x-patch
Size: 965 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171017/89826453/attachment.bin>


More information about the llvm-commits mailing list