[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 07:57:34 PDT 2017
v.g.vassilev created this revision.
Herald added a subscriber: mgorny.
This allows us to use standard cmake utilities to point to non-system zlib locations.
Repository:
rL LLVM
https://reviews.llvm.org/D39002
Files:
interpreter/CMakeLists.txt
interpreter/llvm/src/cmake/config-ix.cmake
interpreter/llvm/src/lib/Support/CMakeLists.txt
Index: interpreter/llvm/src/lib/Support/CMakeLists.txt
===================================================================
--- interpreter/llvm/src/lib/Support/CMakeLists.txt
+++ interpreter/llvm/src/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_LIBRARY})
endif()
if( UNIX AND NOT (BEOS OR HAIKU) )
set(system_libs ${system_libs} m)
Index: interpreter/llvm/src/cmake/config-ix.cmake
===================================================================
--- interpreter/llvm/src/cmake/config-ix.cmake
+++ interpreter/llvm/src/cmake/config-ix.cmake
@@ -131,7 +131,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()
Index: interpreter/CMakeLists.txt
===================================================================
--- interpreter/CMakeLists.txt
+++ interpreter/CMakeLists.txt
@@ -21,6 +21,11 @@
set(LLVM_ENABLE_CXX1Y ON CACHE BOOL "" FORCE)
endif()
+if(builtin_zlib)
+ set(ZLIB_INCLUDE_DIR ${CMAKE_BINARY_DIR}/include CACHE BOOL "" FORCE)
+ set(ZLIB_LIBRARY ${CMAKE_BINARY_DIR}/lib/libZLIB.a CACHE BOOL "" FORCE)
+endif()
+
# The llvm::ReverseIterate<bool>::value symbol from llvm's SmallPtrSet.h
# somehow lands in our cling libraries on OS X and doesn't get hidden
# by visibility-inlines-hidden, so we suddenly have a global weak symbol
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39002.119321.patch
Type: text/x-patch
Size: 1728 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171017/8828c0b9/attachment.bin>
More information about the llvm-commits
mailing list