Skip to content

Commit

Permalink
Use FindCurses to detect the curses or ncurses library. (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
phkaeser authored Jan 13, 2025
1 parent 69a87c3 commit c2e88af
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ ENDIF()

# Defaults to /usr/local/lib for installation.
INCLUDE(GNUInstallDirs)
INCLUDE(FindCurses)

IF(NOT CURSES_FOUND)
MESSAGE(
FATAL_ERROR
"Failed to find curses nor ncurses file and library.")
ENDIF(NOT CURSES_FOUND)

# Configuration. Remove CMakeCache.txt to rerun...
OPTION(config_DEBUG "Include debugging information" ON)
Expand All @@ -55,8 +62,6 @@ IF(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
ENDIF()
SET(CMAKE_C_STANDARD 11)

FIND_PACKAGE(Curses REQUIRED)

FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(CAIRO REQUIRED IMPORTED_TARGET cairo>=1.16.0)

Expand Down Expand Up @@ -109,9 +114,9 @@ SET(SOURCES

ADD_LIBRARY(base STATIC)
TARGET_SOURCES(base PRIVATE ${SOURCES})
TARGET_INCLUDE_DIRECTORIES(base PRIVATE ${CURSES_CURSES_INCLUDE_DIRS})
TARGET_INCLUDE_DIRECTORIES(base PRIVATE ${CURSES_INCLUDE_DIRS})
TARGET_INCLUDE_DIRECTORIES(base PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..)
TARGET_LINK_LIBRARIES(base PRIVATE ${CURSES_CURSES_LIBRARY})
TARGET_LINK_LIBRARIES(base PRIVATE ${CURSES_LIBRARIES})
SET_TARGET_PROPERTIES(
base PROPERTIES
VERSION 1.0
Expand Down

0 comments on commit c2e88af

Please sign in to comment.