llvm.org GIT mirror llvm / 4c329eb
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316150 91177308-0d34-0410-b5e6-96231b3b80d8 Vassil Vassilev 2 years ago
2 changed file(s) with 12 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
131131 # like strlen, leading to false positives.
132132 if( NOT PURE_WINDOWS AND NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
133133 if (LLVM_ENABLE_ZLIB)
134 check_library_exists(z compress2 "" HAVE_LIBZ)
134 find_package(ZLIB)
135 if (ZLIB_FOUND)
136 set(HAVE_LIBZ 1)
137 else()
138 # Some LLVM bots do not have zlib in a standard location and rely on the
139 # compiler to find it.
140 check_library_exists(z compress2 "" HAVE_LIBZ)
141 if(HAVE_LIBZ)
142 set(ZLIB_LIBRARIES z)
143 endif()
144 endif()
135145 else()
136146 set(HAVE_LIBZ 0)
137147 endif()
2121 endif()
2222 set(system_libs ${system_libs} ${LLVM_PTHREAD_LIB})
2323 if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ )
24 set(system_libs ${system_libs} z)
24 set(system_libs ${system_libs} ${ZLIB_LIBRARIES})
2525 endif()
2626 if( UNIX AND NOT (BEOS OR HAIKU) )
2727 set(system_libs ${system_libs} m)