wgtmac commented on code in PR #1198:
URL: https://github.com/apache/iceberg-cpp/pull/1198#discussion_r4771363037


##########
src/iceberg/CMakeLists.txt:
##########
@@ -194,26 +195,30 @@ list(APPEND
      nlohmann_json::nlohmann_json
      utf8proc::utf8proc
      ZLIB::ZLIB
-     roaring::roaring)
+     roaring::roaring
+     ${ICEBERG_ZSTD_TARGET})
 list(APPEND
      ICEBERG_SHARED_BUILD_INTERFACE_LIBS
      
"$<IF:$<BOOL:${NANOARROW_VENDORED}>,nanoarrow::nanoarrow_static,$<IF:$<TARGET_EXISTS:nanoarrow::nanoarrow_shared>,nanoarrow::nanoarrow_shared,nanoarrow::nanoarrow_static>>"
      nlohmann_json::nlohmann_json
      utf8proc::utf8proc
      ZLIB::ZLIB
-     roaring::roaring)
+     roaring::roaring
+     ${ICEBERG_ZSTD_TARGET})
 list(APPEND
      ICEBERG_STATIC_INSTALL_INTERFACE_LIBS
      
"$<IF:$<BOOL:${NANOARROW_VENDORED}>,iceberg::nanoarrow_static,$<IF:$<TARGET_EXISTS:nanoarrow::nanoarrow_static>,nanoarrow::nanoarrow_static,nanoarrow::nanoarrow_shared>>"
      
"$<IF:$<BOOL:${NLOHMANN_JSON_VENDORED}>,iceberg::nlohmann_json,$<IF:$<TARGET_EXISTS:nlohmann_json::nlohmann_json>,nlohmann_json::nlohmann_json,nlohmann_json::nlohmann_json>>"
      "$<IF:$<BOOL:${UTF8PROC_VENDORED}>,iceberg::utf8proc,utf8proc::utf8proc>"
-     "$<IF:$<BOOL:${CROARING_VENDORED}>,iceberg::roaring,roaring::roaring>")
+     "$<IF:$<BOOL:${CROARING_VENDORED}>,iceberg::roaring,roaring::roaring>"
+     
"$<IF:$<BOOL:${ZSTD_VENDORED}>,iceberg::libzstd_static,${ICEBERG_ZSTD_TARGET}>")

Review Comment:
   This exports the Zstd target picked on the build machine. A consumer with 
Zstd 1.5.5 can find the package but has no `zstd::libzstd` target. Could we 
pick the target on the consumer side, like we do for nanoarrow?



##########
cmake_modules/IcebergThirdpartyToolchain.cmake:
##########
@@ -993,9 +1058,10 @@ if(ICEBERG_BUILD_BUNDLE)
     resolve_aws_sdk_dependency()
   endif()
   resolve_avro_dependency()
-  resolve_zstd_dependency()
 endif()
 
+resolve_zstd_dependency()

Review Comment:
   Vendored Arrow already builds Zstd for Parquet. Now that core also links 
Zstd, the bundle can build and ship two copies.
   
   Could we share one target?
   
   1. Move `resolve_zstd_dependency()` before `resolve_arrow_dependency()`.
   2. In `resolve_arrow_dependency()`, add `set(zstd_SOURCE "SYSTEM")` next to 
`set(ZLIB_SOURCE "SYSTEM")`.
   3. For vendored Zstd, expose `zstd::libzstd_static` as an alias of 
`libzstd_static` and set `ARROW_ZSTD_USE_SHARED` to `OFF`. Arrow's 
`find_package(zstd)` should use the parent FetchContent redirect. For system 
Zstd, set `ARROW_ZSTD_USE_SHARED` so Arrow and core pick the same library.
   
   [Arrow's package 
lookup](https://github.com/apache/arrow/blob/59bea6ec485e7fe351d1aa6753f964f6a6bc353a/cpp/cmake_modules/FindzstdAlt.cmake#L18-L33)
 ยท [Arrow's target 
selection](https://github.com/apache/arrow/blob/59bea6ec485e7fe351d1aa6753f964f6a6bc353a/cpp/cmake_modules/ThirdpartyToolchain.cmake#L3021-L3045)
   
   Could we also check that a downstream project can link the installed 
`iceberg_bundle_static` with that same Zstd dependency?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to