summaryrefslogtreecommitdiff
path: root/Modules/FindCurses.cmake
diff options
context:
space:
mode:
authornick black <dankamongmen@gmail.com>2019-09-21 05:23:52 -0400
committernick black <dankamongmen@gmail.com>2019-09-27 21:29:09 -0400
commit048860e172cb08445fca19ea2e4387e5ea3cedbe (patch)
tree0194e11448f13f759cd87de004fc448d150e3977 /Modules/FindCurses.cmake
parent47a12c658591c0ea26b7e0022d230188b8cb1909 (diff)
downloadcmake-048860e172cb08445fca19ea2e4387e5ea3cedbe.tar.gz
FindCurses: toplevel ncursesw support, recover cflags
Diffstat (limited to 'Modules/FindCurses.cmake')
-rw-r--r--Modules/FindCurses.cmake16
1 files changed, 12 insertions, 4 deletions
diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake
index b3cd8fa497..5abc08a2ed 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``
@@ -56,7 +58,7 @@ else()
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 +120,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
)
@@ -133,7 +135,7 @@ if(CURSES_USE_NCURSES)
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
HINTS "${_cursesParentDir}/include"
)
else()
@@ -238,10 +240,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)