2019-01-04 20:04:18 +00:00
|
|
|
# The following defines affect the environment configuration tests are run in:
|
|
|
|
# CMAKE_REQUIRED_DEFINITIONS, CMAKE_REQUIRED_FLAGS, CMAKE_REQUIRED_LIBRARIES,
|
|
|
|
# and CMAKE_REQUIRED_INCLUDES
|
2020-03-14 23:11:35 +00:00
|
|
|
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE=1)
|
2021-02-22 21:41:24 +00:00
|
|
|
|
2019-01-03 00:38:55 +00:00
|
|
|
# Try using CMake's own logic to locate curses/ncurses
|
2020-03-14 23:11:35 +00:00
|
|
|
find_package(Curses)
|
|
|
|
if(NOT ${CURSES_FOUND})
|
2019-01-03 00:38:55 +00:00
|
|
|
# CMake has trouble finding platform-specific system libraries
|
|
|
|
# installed to multiarch paths (e.g. /usr/lib/x86_64-linux-gnu)
|
|
|
|
# if not symlinked or passed in as a manual define.
|
2020-03-14 23:11:35 +00:00
|
|
|
message("Falling back to pkg-config for (n)curses detection")
|
|
|
|
include(FindPkgConfig)
|
|
|
|
pkg_search_module(CURSES REQUIRED ncurses curses)
|
|
|
|
set(CURSES_CURSES_LIBRARY ${CURSES_LIBRARIES})
|
|
|
|
set(CURSES_LIBRARY ${CURSES_LIBRARIES})
|
|
|
|
endif()
|
2017-08-31 20:24:20 +00:00
|
|
|
|
2020-07-08 15:56:20 +00:00
|
|
|
# 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})
|
2023-05-16 20:02:11 +00:00
|
|
|
else()
|
|
|
|
# on NetBSD, libtinfo has a longer name (libterminfo)
|
|
|
|
find_library(CURSES_TINFO terminfo)
|
|
|
|
if (CURSES_TINFO)
|
|
|
|
set(CURSES_LIBRARY ${CURSES_LIBRARY} ${CURSES_TINFO})
|
|
|
|
endif()
|
2020-07-08 15:56:20 +00:00
|
|
|
endif()
|