@@ -86,6 +86,12 @@ function(resolve_arrow_dependency)
8686 set (ARROW_DEPENDENCY_SOURCE
8787 "BUNDLED"
8888 CACHE STRING "" FORCE)
89+ set (ARROW_WITH_ZLIB
90+ ON
91+ CACHE BOOL "" FORCE)
92+ set (ZLIB_SOURCE
93+ "SYSTEM"
94+ CACHE STRING "" FORCE)
8995
9096 fetchcontent_declare(VendoredArrow
9197 ${FC_DECLARE_COMMON_OPTIONS}
@@ -153,10 +159,6 @@ function(resolve_arrow_dependency)
153159 PARENT_SCOPE)
154160endfunction ()
155161
156- if (ICEBERG_BUILD_BUNDLE)
157- resolve_arrow_dependency()
158- endif ()
159-
160162# ----------------------------------------------------------------------
161163# Apache Avro
162164
@@ -211,7 +213,6 @@ function(resolve_avro_dependency)
211213 if (Snappy_FOUND)
212214 list (APPEND ICEBERG_SYSTEM_DEPENDENCIES Snappy)
213215 endif ()
214- list (APPEND ICEBERG_SYSTEM_DEPENDENCIES ZLIB)
215216 else ()
216217 set (AVRO_VENDORED FALSE )
217218 list (APPEND ICEBERG_SYSTEM_DEPENDENCIES Avro)
@@ -225,10 +226,6 @@ function(resolve_avro_dependency)
225226 PARENT_SCOPE)
226227endfunction ()
227228
228- if (ICEBERG_BUILD_BUNDLE)
229- resolve_avro_dependency()
230- endif ()
231-
232229# ----------------------------------------------------------------------
233230# Nanoarrow
234231
@@ -251,8 +248,6 @@ function(resolve_nanoarrow_dependency)
251248 LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR} " )
252249endfunction ()
253250
254- resolve_nanoarrow_dependency()
255-
256251# ----------------------------------------------------------------------
257252# nlohmann-json
258253
@@ -284,4 +279,28 @@ function(resolve_nlohmann_json_dependency)
284279 LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR} " )
285280endfunction ()
286281
282+ # ----------------------------------------------------------------------
283+ # zlib
284+
285+ function (resolve_zlib_dependency)
286+ # use system zlib, zlib is required by arrow and avro
287+ find_package (ZLIB REQUIRED)
288+ if (ZLIB_FOUND)
289+ list (APPEND ICEBERG_SYSTEM_DEPENDENCIES ZLIB)
290+ message (STATUS "ZLIB_FOUND ZLIB_LIBRARIES:${ZLIB_LIBRARIES} ZLIB_INCLUDE_DIR:${ZLIB_INCLUDE_DIR} "
291+ )
292+ set (ICEBERG_SYSTEM_DEPENDENCIES
293+ ${ICEBERG_SYSTEM_DEPENDENCIES}
294+ PARENT_SCOPE)
295+ endif ()
296+
297+ endfunction ()
298+
299+ resolve_zlib_dependency()
300+ resolve_nanoarrow_dependency()
287301resolve_nlohmann_json_dependency()
302+
303+ if (ICEBERG_BUILD_BUNDLE)
304+ resolve_arrow_dependency()
305+ resolve_avro_dependency()
306+ endif ()
0 commit comments