diff options
Diffstat (limited to 'Modules/FindCurses.cmake')
-rw-r--r-- | Modules/FindCurses.cmake | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index b3cd8fa49..e3e7273be 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -18,6 +18,8 @@ This module defines the following variables: The include directories needed to use Curses. ``CURSES_LIBRARIES`` The libraries needed to use Curses. +``CURSES_CFLAGS`` + Parameters which ought be given to C/C++ compilers when using Curses. ``CURSES_HAVE_CURSES_H`` True if curses.h is available. ``CURSES_HAVE_NCURSES_H`` @@ -49,14 +51,16 @@ include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) # may be ncursesw if(NOT CURSES_NEED_WIDE) set(NCURSES_LIBRARY_NAME "ncurses") + set(CURSES_FORM_LIBRARY_NAME "form") else() set(NCURSES_LIBRARY_NAME "ncursesw") - # Also, if we are searchig fo wide curses - we are actually searching + set(CURSES_FORM_LIBRARY_NAME "formw") + # Also, if we are searching for wide curses - we are actually searching # for ncurses, we don't know about any other unicode version. set(CURSES_NEED_NCURSES TRUE) endif() -find_library(CURSES_CURSES_LIBRARY NAMES curses ) +find_library(CURSES_CURSES_LIBRARY NAMES curses) find_library(CURSES_NCURSES_LIBRARY NAMES "${NCURSES_LIBRARY_NAME}" ) set(CURSES_USE_NCURSES FALSE) @@ -118,7 +122,7 @@ if(CURSES_USE_NCURSES) if(CURSES_NCURSES_INCLUDE_PATH) if (CURSES_NEED_WIDE) find_path(CURSES_INCLUDE_PATH - NAMES ncursesw/ncurses.h ncursesw/curses.h + NAMES ncursesw/ncurses.h ncursesw/curses.h ncursesw.h cursesw.h PATHS ${CURSES_NCURSES_INCLUDE_PATH} NO_DEFAULT_PATH ) @@ -132,11 +136,13 @@ if(CURSES_USE_NCURSES) endif() if (CURSES_NEED_WIDE) + set(CURSES_TINFO_LIBRARY_NAME tinfow) find_path(CURSES_INCLUDE_PATH - NAMES ncursesw/ncurses.h ncursesw/curses.h + NAMES ncursesw/ncurses.h ncursesw/curses.h ncursesw.h cursesw.h HINTS "${_cursesParentDir}/include" ) else() + set(CURSES_TINFO_LIBRARY_NAME tinfo) find_path(CURSES_INCLUDE_PATH NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h HINTS "${_cursesParentDir}/include" @@ -151,8 +157,8 @@ if(CURSES_USE_NCURSES) 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 ) + find_library(CURSES_EXTRA_LIBRARY "${CURSES_TINFO_LIBRARY_NAME}" HINTS "${_cursesLibDir}") + find_library(CURSES_EXTRA_LIBRARY "${CURSES_TINFO_LIBRARY_NAME}" ) endif() else() get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH) @@ -219,8 +225,8 @@ if(NOT CURSES_NEED_WIDE) endif() endif() -find_library(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}") -find_library(CURSES_FORM_LIBRARY form ) +find_library(CURSES_FORM_LIBRARY "${CURSES_FORM_LIBRARY_NAME}" HINTS "${_cursesLibDir}") +find_library(CURSES_FORM_LIBRARY "${CURSES_FORM_LIBRARY_NAME}" ) # Previous versions of FindCurses provided these values. if(NOT DEFINED FORM_LIBRARY) @@ -238,10 +244,16 @@ if(CURSES_FORM_LIBRARY) set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_FORM_LIBRARY}) endif() -# Provide the *_INCLUDE_DIRS result. +# Provide the *_INCLUDE_DIRS and *_CFLAGS results. set(CURSES_INCLUDE_DIRS ${CURSES_INCLUDE_PATH}) set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) # compatibility +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_check_modules(NCURSES QUIET ${NCURSES_LIBRARY_NAME}) + set(CURSES_CFLAGS ${NCURSES_CFLAGS_OTHER}) +endif() + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG CURSES_LIBRARY CURSES_INCLUDE_PATH) |