================ @@ -2,23 +2,54 @@ # FindCursesAndPanel # ----------- # -# Find the curses and panel library as a whole. +# Find the curses, terminfo, and panel library as a whole. -if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES) +include(CMakePushCheckState) + +function(lldb_check_curses_tinfo CURSES_LIBRARIES CURSES_HAS_TINFO) + cmake_reset_check_state() + set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}") + # acs_map is one of many symbols that are part of tinfo but could + # be bundled in curses. + check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO) +endfunction() + +if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND PANEL_LIBRARIES) set(CURSESANDPANEL_FOUND TRUE) else() find_package(Curses QUIET) find_library(PANEL_LIBRARIES NAMES panel DOC "The curses panel library" QUIET) include(FindPackageHandleStandardArgs) + + # Sometimes the curses libraries define their own terminfo symbols, + # other times they're extern and are defined by a separate terminfo library. + # Auto-detect which. + lldb_check_curses_tinfo("${CURSES_LIBRARIES}" CURSES_HAS_TINFO) + if(CURSES_FOUND AND PANEL_LIBRARIES) + if (NOT CURSES_HAS_TINFO) ---------------- ajordanr-google wrote:
As above, I'm going to keep `lldb_check_curses_tinfo()`, but I should indeed move this into the `if`. Thanks! https://github.com/llvm/llvm-project/pull/126810 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits