gemini-code-assist[bot] commented on code in PR #360:
URL: https://github.com/apache/tvm-ffi/pull/360#discussion_r2642176233
##########
CMakeLists.txt:
##########
@@ -122,6 +124,14 @@ endif ()
tvm_ffi_add_msvc_flags(tvm_ffi_objs)
tvm_ffi_add_target_from_obj(tvm_ffi tvm_ffi_objs)
+target_link_libraries(tvm_ffi_shared PRIVATE Threads::Threads)
+target_link_libraries(tvm_ffi_static PRIVATE Threads::Threads)
+
+if (TVM_FFI_USE_EXTRA_CXX_API AND CMAKE_DL_LIBS)
+ target_link_libraries(tvm_ffi_shared PRIVATE ${CMAKE_DL_LIBS})
+ target_link_libraries(tvm_ffi_static PRIVATE ${CMAKE_DL_LIBS})
Review Comment:

Similar to the `Threads` dependency, linking `${CMAKE_DL_LIBS}` as `PRIVATE`
to a static library does not propagate the dependency. This will cause linking
errors for consumers of `tvm_ffi_static`. You should use `INTERFACE` to ensure
that targets linking against `tvm_ffi_static` also link against the `dl`
library.
```
target_link_libraries(tvm_ffi_static INTERFACE ${CMAKE_DL_LIBS})
```
##########
CMakeLists.txt:
##########
@@ -122,6 +124,14 @@ endif ()
tvm_ffi_add_msvc_flags(tvm_ffi_objs)
tvm_ffi_add_target_from_obj(tvm_ffi tvm_ffi_objs)
+target_link_libraries(tvm_ffi_shared PRIVATE Threads::Threads)
+target_link_libraries(tvm_ffi_static PRIVATE Threads::Threads)
Review Comment:

For static libraries, `target_link_libraries` with `PRIVATE` does not
propagate the link dependency to consumers. This means any executable that
links against `tvm_ffi_static` will fail with unresolved symbols from the
`Threads` library unless it explicitly links with it. To fix this, you should
use `INTERFACE` to properly declare the usage requirement.
```
target_link_libraries(tvm_ffi_static INTERFACE Threads::Threads)
```
--
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]