[llvm] r316150 - Reinstate r316025, reverted in r316029.

Vassil Vassilev via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 19 01:04:22 PDT 2017


Author: vvassilev
Date: Thu Oct 19 01:04:22 2017
New Revision: 316150

URL: http://llvm.org/viewvc/llvm-project?rev=316150&view=rev
Log:
Reinstate r316025, reverted in r316029.

Original commit message:
"[cmake] Use find_package to discover zlib

This allows us to use standard cmake utilities to point to non-system zlib
locations.

Patch by Oksana Shadura and me (D39002)."

The new patch brings back the old behavior in the cases where find_package
cannot find zlib.


Modified:
    llvm/trunk/cmake/config-ix.cmake
    llvm/trunk/lib/Support/CMakeLists.txt

Modified: llvm/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=316150&r1=316149&r2=316150&view=diff
==============================================================================
--- llvm/trunk/cmake/config-ix.cmake (original)
+++ llvm/trunk/cmake/config-ix.cmake Thu Oct 19 01:04:22 2017
@@ -132,7 +132,17 @@ endif()
 # 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)
+    if (ZLIB_FOUND)
+      set(HAVE_LIBZ 1)
+    else()
+      # Some LLVM bots do not have zlib in a standard location and rely on the
+      # compiler to find it.
+      check_library_exists(z compress2 "" HAVE_LIBZ)
+      if(HAVE_LIBZ)
+        set(ZLIB_LIBRARIES z)
+      endif()
+    endif()
   else()
     set(HAVE_LIBZ 0)
   endif()

Modified: llvm/trunk/lib/Support/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CMakeLists.txt?rev=316150&r1=316149&r2=316150&view=diff
==============================================================================
--- llvm/trunk/lib/Support/CMakeLists.txt (original)
+++ llvm/trunk/lib/Support/CMakeLists.txt Thu Oct 19 01:04:22 2017
@@ -22,7 +22,7 @@ elseif( CMAKE_HOST_UNIX )
   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)




More information about the llvm-commits mailing list