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::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 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/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)