Copilot commented on code in PR #50195:
URL: https://github.com/apache/arrow/pull/50195#discussion_r3982698296


##########
cpp/examples/minimal_build/CMakeLists.txt:
##########
@@ -49,3 +49,14 @@ if(ARROW_LINK_SHARED)
 else()
   target_link_libraries(arrow-example PRIVATE Arrow::arrow_static)
 endif()
+
+option(ARROW_EXAMPLE_S3 "Verify S3 and static linking" OFF)
+if(ARROW_EXAMPLE_S3 AND TARGET Arrow::arrow_static)
+  add_executable(arrow-example-s3-static example.cc)
+  target_compile_definitions(arrow-example-s3-static PRIVATE ARROW_EXAMPLE_S3)
+  target_link_libraries(arrow-example-s3-static PRIVATE Arrow::arrow_static)
+  find_package(ArrowS3 QUIET)
+  if(TARGET ArrowS3::arrow_s3_static)
+    target_link_libraries(arrow-example-s3-static PRIVATE 
ArrowS3::arrow_s3_static)
+  endif()
+endif()

Review Comment:
   When `ARROW_EXAMPLE_S3=ON`, `arrow-example-s3-static` is always created and 
compiled with S3 calls, but it only links ArrowS3 conditionally. If 
`find_package(ArrowS3)` fails (or the static target isn’t available), this will 
fail at link time with unclear errors. It’s better to either require ArrowS3 
when the option is enabled or skip creating the target when ArrowS3 isn’t found.



-- 
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]

Reply via email to