gemini-code-assist[bot] commented on code in PR #18700:
URL: https://github.com/apache/tvm/pull/18700#discussion_r2749251316


##########
CMakeLists.txt:
##########
@@ -671,6 +671,17 @@ if(GTEST_FOUND)
       target_link_libraries(cpptest PRIVATE ${LLVM_LIBS})
     endif()
   endif()
+  # Ensure we link terminfo when required by LLVM / libedit at link time.
+  if(NOT DEFINED TINFO_LIB)
+    find_library(TINFO_LIB tinfo)
+  endif()
+  if(TINFO_LIB)
+    message(STATUS "Found terminfo library: ${TINFO_LIB}")
+    target_link_libraries(cpptest PRIVATE ${TINFO_LIB})
+    if(TARGET tvm_allvisible)
+      target_link_libraries(tvm_allvisible PRIVATE ${TINFO_LIB})
+    endif()
+  endif()

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   This logic to link `terminfo` is only required when LLVM is used. For better 
code organization and to avoid introducing unnecessary dependencies when LLVM 
is not used, this entire block should be moved inside the `if(DEFINED 
LLVM_LIBS)` block above (lines 655-673).
   
   Additionally, for improved portability, it's better to use the standard 
CMake module `find_package(Curses)` instead of `find_library(tinfo)`. It 
correctly handles finding `ncurses` and `tinfo` across different systems.
   
   ```
   # Ensure we link terminfo when required by LLVM / libedit at link time.
   find_package(Curses)
   if(CURSES_FOUND)
     message(STATUS "Found Curses/Terminfo library: ${CURSES_LIBRARIES}")
     target_link_libraries(cpptest PRIVATE ${CURSES_LIBRARIES})
     if(TARGET tvm_allvisible)
       target_link_libraries(tvm_allvisible PRIVATE ${CURSES_LIBRARIES})
     endif()
   endif()
   ```



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