gemini-code-assist[bot] commented on code in PR #360:
URL: https://github.com/apache/tvm-ffi/pull/360#discussion_r2642184357
##########
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 INTERFACE 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 INTERFACE ${CMAKE_DL_LIBS})
+endif ()
Review Comment:

For better readability and maintainability, you can consolidate the linking
logic. Instead of conditionally calling `target_link_libraries`, you can
conditionally set a variable with the extra libraries and then have a single
set of `target_link_libraries` calls. This makes it clearer what libraries are
being linked to each target.
```
set(TVM_FFI_DL_LIBS "")
if(TVM_FFI_USE_EXTRA_CXX_API AND CMAKE_DL_LIBS)
set(TVM_FFI_DL_LIBS ${CMAKE_DL_LIBS})
endif()
target_link_libraries(tvm_ffi_shared PRIVATE Threads::Threads
${TVM_FFI_DL_LIBS})
target_link_libraries(tvm_ffi_static INTERFACE Threads::Threads
${TVM_FFI_DL_LIBS})
```
--
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]