summaryrefslogtreecommitdiffstats
path: root/Modules/FindCurses.cmake
diff options
context:
space:
mode:
authorMark Wright <gienah@gentoo.org>2014-01-17 11:34:58 (GMT)
committerBrad King <brad.king@kitware.com>2014-05-06 19:29:33 (GMT)
commit1f646c6ce0766f8ab59868e7cac24034e6966504 (patch)
treee0276cc374858042638da4fdbb89caf1e49beaf1 /Modules/FindCurses.cmake
parent0e4a2c7e3251c305cc4a9a02fa32011b3c142f5a (diff)
downloadCMake-1f646c6ce0766f8ab59868e7cac24034e6966504.zip
CMake-1f646c6ce0766f8ab59868e7cac24034e6966504.tar.gz
CMake-1f646c6ce0766f8ab59868e7cac24034e6966504.tar.bz2
FindCurses: Detect and satisfy ncurses dependency on tinfo
When ncurses is built with USE=tinfo we need to find "tinfo" as a dependency of the main library. Otherwise 'cbreak' is missing: ld: ...: undefined reference to symbol 'cbreak' ld: note: 'cbreak' is defined in DSO /lib/libtinfo.so.5 so try adding it to the linker command line See https://bugs.gentoo.org/show_bug.cgi?id=468622 for more information. Applied-by: Rolf Eike Beer <eike@sf-mail.de>
Diffstat (limited to 'Modules/FindCurses.cmake')
-rw-r--r--Modules/FindCurses.cmake16
1 files changed, 14 insertions, 2 deletions
diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake
index 7948551..a453a67 100644
--- a/Modules/FindCurses.cmake
+++ b/Modules/FindCurses.cmake
@@ -135,10 +135,20 @@ else()
CACHE FILEPATH "The curses library" ${FORCE_IT})
endif()
+ CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}"
+ cbreak "" CURSES_NCURSES_HAS_CBREAK)
+ if(NOT CURSES_NCURSES_HAS_CBREAK)
+ find_library(CURSES_EXTRA_LIBRARY tinfo HINTS "${_cursesLibDir}")
+ find_library(CURSES_EXTRA_LIBRARY tinfo )
+ CHECK_LIBRARY_EXISTS("${CURSES_EXTRA_LIBRARY}"
+ cbreak "" CURSES_TINFO_HAS_CBREAK)
+ endif()
endif()
-find_library(CURSES_EXTRA_LIBRARY cur_colr HINTS "${_cursesLibDir}")
-find_library(CURSES_EXTRA_LIBRARY cur_colr )
+if (NOT CURSES_TINFO_HAS_CBREAK)
+ find_library(CURSES_EXTRA_LIBRARY cur_colr HINTS "${_cursesLibDir}")
+ find_library(CURSES_EXTRA_LIBRARY cur_colr )
+endif()
find_library(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}")
find_library(CURSES_FORM_LIBRARY form )
@@ -182,5 +192,7 @@ mark_as_advanced(
CURSES_INCLUDE_DIR
CURSES_CURSES_HAS_WSYNCUP
CURSES_NCURSES_HAS_WSYNCUP
+ CURSES_NCURSES_HAS_CBREAK
+ CURSES_TINFO_HAS_CBREAK
)