Skip to content

Commit ff5884d

Browse files
[lldb] Fix manual CURSES_LIBRARIES tinfo finding
At present, we automatically detect terminfo symbols in CURSES_LIBRARIES after it is found through `find_package`. However, by introducing a check for TINFO_LIBRARIES, we break systems which pass all of CURSES_INCLUDE_DIRS, CURSES_LIBRARIES, and PANEL_LIBRARIES individually without passing TINFO_LIBRARIES. We'd rather not expose TINFO_LIBRARIES at all. This commit preemptively attempts to fix issues encountered on systems that manually pass CURSES_LIBRARIES which already contain the necessary terminfo symbols (e.g. 'acs_map'). Additionally, let's not make CURSES_LIBRARIES a list. That was odd to begin with. See this breakage in Google Fuchsia: https://issues.fuchsia.dev/397455029 References Issue #101368
1 parent 1841bcd commit ff5884d

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

lldb/cmake/modules/FindCursesAndPanel.cmake

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,24 @@
66

77
include(CMakePushCheckState)
88

9-
function(lldb_check_curses_tinfo CURSES_LIBRARIES CURSES_HAS_TINFO)
9+
function(lldb_check_curses_tinfo CURSES_HEADER CURSES_LIBRARIES CURSES_HAS_TINFO)
1010
cmake_reset_check_state()
1111
set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")
1212
# acs_map is one of many symbols that are part of tinfo but could
1313
# be bundled in curses.
14-
check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
14+
check_symbol_exists(acs_map "${CURSES_HEADER}" CURSES_HAS_TINFO)
1515
endfunction()
1616

17-
if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND PANEL_LIBRARIES)
17+
if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
18+
if(NOT HAS_TERMINFO_SYMBOLS)
19+
lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}/curses.h"
20+
"${CURSES_LIBRARIES}"
21+
CURSES_HAS_TINFO)
22+
if (NOT CURSES_HAS_TINFO)
23+
message(WARNING "CURSES_LIBRARIES was provided manually but is missing terminfo symbols")
24+
endif()
25+
mark_as_advanced(CURSES_HAS_TINFO)
26+
endif()
1827
set(CURSESANDPANEL_FOUND TRUE)
1928
else()
2029
find_package(Curses QUIET)
@@ -25,7 +34,9 @@ else()
2534
# Sometimes the curses libraries define their own terminfo symbols,
2635
# other times they're extern and are defined by a separate terminfo library.
2736
# Auto-detect which.
28-
lldb_check_curses_tinfo("${CURSES_LIBRARIES}" CURSES_HAS_TINFO)
37+
lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}/curses.h"
38+
"${CURSES_LIBRARIES}"
39+
CURSES_HAS_TINFO)
2940
if (NOT CURSES_HAS_TINFO)
3041
message(STATUS "curses library missing terminfo symbols, looking for tinfo separately")
3142
find_library(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" QUIET)

0 commit comments

Comments
 (0)