From 7af0cad23dd2e9d4438e742f80c63a44d9cb4683 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Wed, 2 Jan 2019 18:38:55 -0600 Subject: [PATCH] Fall back to CMake's pkg-config-based search for curses CMake seems to have trouble finding libraries from multiarch packages that do not have the compatibility symlink installed to the arch-independent library directory. Users must either manually supply the path to the library in question via command-line parameters or we can fall back to CMake's alternate method of finding packages based off of pkg-config rather than using the hard-coded `FindCurses` CMake module specific to the CMake version/distribution installed. --- cmake/ConfigureChecks.cmake | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index e4fc14039..a9ddf674d 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -1,5 +1,15 @@ -# Detect curses. -FIND_PACKAGE(Curses REQUIRED) +# Try using CMake's own logic to locate curses/ncurses +FIND_PACKAGE(Curses) +IF(NOT ${CURSES_FOUND}) + # 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. + 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() # Get threads. set(THREADS_PREFER_PTHREAD_FLAG ON)