Fix missing references when manually linking against curses

When CMake's own curses logic fails to find curses/ncurses, we fall back to
pkg-config and manually link the required libraries. Some platforms (RHEL 6,
see #6587) require CURSES_EXTRA_LIBRARY=tinfo, so we link against libtinfo
if it's found but are happy to continue without it if it doesn't exist.

Closes #6587
This commit is contained in:
Mahmoud Al-Qudsi 2020-07-08 10:56:20 -05:00
parent 35cb449aa1
commit 4a5f0f3a3d

View File

@ -33,6 +33,14 @@ if(NOT ${CURSES_FOUND})
set(CURSES_LIBRARY ${CURSES_LIBRARIES})
endif()
# Fix undefined reference to tparm on RHEL 6 and potentially others
# If curses is found via CMake, it also links against tinfo if it exists. But if we use our
# fallback pkg-config logic above, we need to do this manually.
find_library(CURSES_TINFO tinfo)
if (CURSES_TINFO)
set(CURSES_LIBRARY ${CURSES_LIBRARY} ${CURSES_TINFO})
endif()
# Get threads.
set(THREADS_PREFER_PTHREAD_FLAG ON)
# FindThreads < 3.4.0 doesn't work for C++-only projects