1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

Fix ncurses detection.

We now provide a FindNcurses.cmake to find the library used
and we define the right cpp variable when we compile the curses gui.

Signed-off-by: Julien Louis <ptitlouis@sysif.net>
This commit is contained in:
Julien Louis
2007-05-21 22:20:13 +00:00
parent ba468f2234
commit e867f2dd35
4 changed files with 70 additions and 22 deletions
+23
View File
@@ -0,0 +1,23 @@
IF(NCURSES_FOUND)
SET(NCURSES_FIND_QUIETLY TRUE)
ENDIF(NCURSES_FOUND)
FIND_PATH(NCURSES_INCLUDE_PATH
NAMES ncurses.h curses.h
PATHS /usr/include /usr/local/include /usr/pkg/include
)
FIND_LIBRARY(NCURSES_LIBRARY
NAMES ncursesw ncurses
PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib
)
IF (NCURSES_INCLUDE_PATH AND NCURSES_LIBRARY)
SET(NCURSES_FOUND TRUE)
ENDIF(NCURSES_INCLUDE_PATH AND NCURSES_LIBRARY)
MARK_AS_ADVANCED(
NCURSES_INCLUDE_PATH
NCURSES_LIBRARY
)
+12 -11
View File
@@ -21,19 +21,20 @@ gui-curses-status.c gui-curses-window.c gui-curses-panel.c gui-curses.h)
SET(EXECUTABLE weechat-curses)
INCLUDE(CheckLibraryExists)
# Check for ncurses and/or ncursesw
CHECK_INCLUDE_FILES(ncursesw/ncurses.h NCURSESW_HEADERS)
CHECK_LIBRARY_EXISTS(ncursesw initscr "" NCURSESW_FOUND)
FIND_PACKAGE(Ncurses)
IF(NCURSES_FOUND)
CHECK_INCLUDE_FILES(ncursesw/ncurses.h NCURSESW_HEADERS)
IF(NCURSESW_HEADERS)
ADD_DEFINITIONS(-DHAVE_NCURSESW_CURSES_H)
ENDIF(NCURSESW_HEADERS)
IF(NCURSESW_FOUND)
ADD_DEFINITIONS(-DHAVE_NCURSESW_CURSES_H)
LIST(APPEND EXTRA_LIBS ncursesw)
ELSE(NCURSESW_FOUND)
CHECK_INCLUDE_FILES(ncurses.h NCURSES_HEADERS)
CHECK_LIBRARY_EXISTS(ncurses initscr "" NCURSES_FOUND)
LIST(APPEND EXTRA_LIBS ncurses)
ENDIF(NCURSESW_FOUND)
IF(NCURSES_HEADERS)
ADD_DEFINITIONS(-DHAVE_NCURSES_H)
ENDIF(NCURSES_HEADERS)
LIST(APPEND EXTRA_LIBS ${NCURSES_LIBRARY})
ENDIF(NCURSES_FOUND)
ADD_EXECUTABLE(${EXECUTABLE} ${WEECHAT_CURSES_SRC})
INCLUDE_DIRECTORIES(.. ../../common ../../irc ../../plugins)
+23
View File
@@ -0,0 +1,23 @@
IF(NCURSES_FOUND)
SET(NCURSES_FIND_QUIETLY TRUE)
ENDIF(NCURSES_FOUND)
FIND_PATH(NCURSES_INCLUDE_PATH
NAMES ncurses.h curses.h
PATHS /usr/include /usr/local/include /usr/pkg/include
)
FIND_LIBRARY(NCURSES_LIBRARY
NAMES ncursesw ncurses
PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib
)
IF (NCURSES_INCLUDE_PATH AND NCURSES_LIBRARY)
SET(NCURSES_FOUND TRUE)
ENDIF(NCURSES_INCLUDE_PATH AND NCURSES_LIBRARY)
MARK_AS_ADVANCED(
NCURSES_INCLUDE_PATH
NCURSES_LIBRARY
)
+12 -11
View File
@@ -21,19 +21,20 @@ gui-curses-status.c gui-curses-window.c gui-curses-panel.c gui-curses.h)
SET(EXECUTABLE weechat-curses)
INCLUDE(CheckLibraryExists)
# Check for ncurses and/or ncursesw
CHECK_INCLUDE_FILES(ncursesw/ncurses.h NCURSESW_HEADERS)
CHECK_LIBRARY_EXISTS(ncursesw initscr "" NCURSESW_FOUND)
FIND_PACKAGE(Ncurses)
IF(NCURSES_FOUND)
CHECK_INCLUDE_FILES(ncursesw/ncurses.h NCURSESW_HEADERS)
IF(NCURSESW_HEADERS)
ADD_DEFINITIONS(-DHAVE_NCURSESW_CURSES_H)
ENDIF(NCURSESW_HEADERS)
IF(NCURSESW_FOUND)
ADD_DEFINITIONS(-DHAVE_NCURSESW_CURSES_H)
LIST(APPEND EXTRA_LIBS ncursesw)
ELSE(NCURSESW_FOUND)
CHECK_INCLUDE_FILES(ncurses.h NCURSES_HEADERS)
CHECK_LIBRARY_EXISTS(ncurses initscr "" NCURSES_FOUND)
LIST(APPEND EXTRA_LIBS ncurses)
ENDIF(NCURSESW_FOUND)
IF(NCURSES_HEADERS)
ADD_DEFINITIONS(-DHAVE_NCURSES_H)
ENDIF(NCURSES_HEADERS)
LIST(APPEND EXTRA_LIBS ${NCURSES_LIBRARY})
ENDIF(NCURSES_FOUND)
ADD_EXECUTABLE(${EXECUTABLE} ${WEECHAT_CURSES_SRC})
INCLUDE_DIRECTORIES(.. ../../common ../../irc ../../plugins)