66
77include (CMakePushCheckState)
88
9- function (lldb_check_curses_tinfo CURSES_LIBRARIES CURSES_HAS_TINFO)
9+ function (lldb_check_curses_tinfo CURSES_INCLUDE_DIRS CURSES_LIBRARIES CURSES_HAS_TINFO)
1010 cmake_reset_check_state()
11+ set (CMAKE_REQUIRED_INCLUDES "${CURSES_INCLUDE_DIRS} " )
1112 set (CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES} " )
1213 # acs_map is one of many symbols that are part of tinfo but could
1314 # be bundled in curses.
1415 check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
1516endfunction ()
1617
17- if (CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND PANEL_LIBRARIES)
18+ if (CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
19+ if (NOT HAS_TERMINFO_SYMBOLS)
20+ lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS} "
21+ "${CURSES_LIBRARIES} "
22+ CURSES_HAS_TINFO)
23+ if (NOT CURSES_HAS_TINFO)
24+ message (WARNING "CURSES_LIBRARIES was provided manually but is missing terminfo symbols" )
25+ endif ()
26+ mark_as_advanced (CURSES_HAS_TINFO)
27+ endif ()
1828 set (CURSESANDPANEL_FOUND TRUE )
1929else ()
2030 find_package (Curses QUIET )
@@ -25,8 +35,10 @@ else()
2535 # Sometimes the curses libraries define their own terminfo symbols,
2636 # other times they're extern and are defined by a separate terminfo library.
2737 # Auto-detect which.
28- lldb_check_curses_tinfo("${CURSES_LIBRARIES} " CURSES_HAS_TINFO)
29- if (NOT CURSES_HAS_TINFO)
38+ lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS} "
39+ "${CURSES_LIBRARIES} "
40+ CURSES_HAS_TINFO)
41+ if (NOT CURSES_HAS_TINFO)
3042 message (STATUS "curses library missing terminfo symbols, looking for tinfo separately" )
3143 find_library (TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" QUIET )
3244 list (APPEND CURSES_LIBRARIES "${TINFO_LIBRARIES} " )
0 commit comments