Finds the curses or ncurses library.
Curses is a terminal control library for Unix-like systems, used to build text user interface (TUI) applications. Originally developed in 1978, it has since evolved into multiple implementations, most notably ncurses (new curses), BSD curses, and PDCurses (a public domain curses library for non-Unix platforms).
This module defines the following variables:
Curses_FOUNDBoolean indicating whether the Curses is found. For backward compatibility,
the CURSES_FOUND variable is also set to the same value.
CURSES_INCLUDE_DIRSAdded in version 3.1.
The include directories needed to use Curses.
CURSES_LIBRARIESThe libraries needed to use Curses.
CURSES_CFLAGSAdded in version 3.16.
Compiler flags which ought be given to C/C++ compilers when using Curses.
CURSES_HAVE_CURSES_HBoolean indicating whether curses.h is available.
CURSES_HAVE_NCURSES_HBoolean indicating whether ncurses.h is available.
CURSES_HAVE_NCURSES_NCURSES_HBoolean indicating whether ncurses/ncurses.h is available.
CURSES_HAVE_NCURSES_CURSES_HBoolean indicating whether ncurses/curses.h is available.
This module accepts the following variables:
CURSES_NEED_NCURSESSet this variable to TRUE before calling find_package(Curses) if the
the ncurses implementation functionality is specifically required.
CURSES_NEED_WIDEAdded in version 3.10.
Set this variable to TRUE before calling find_package(Curses) if
Unicode (wide character) support is required.
The following legacy variables are provided for backward compatibility:
CURSES_INCLUDE_DIRDeprecated since version 3.1: Use the CURSES_INCLUDE_DIRS variable instead.
Path to a Curses include directory.
CURSES_LIBRARYDeprecated since version 2.4: Use the CURSES_LIBRARIES variable instead.
Path to Curses library.
Finding Curses and creating an imported interface target for linking it to a project target:
find_package(Curses)
if(Curses_FOUND AND NOT TARGET Curses::Curses)
add_library(Curses::Curses INTERFACE IMPORTED)
set_target_properties(
Curses::Curses
PROPERTIES
INTERFACE_LINK_LIBRARIES "${CURSES_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${CURSES_INCLUDE_DIRS}"
)
endif()
add_executable(app app.c)
target_link_libraries(app PRIVATE Curses::Curses)
When ncurses is specifically required:
set(CURSES_NEED_NCURSES TRUE)
find_package(Curses)