Force the use of libncursesw
authorPierre Habouzit <madcoder@debian.org>
Sat, 17 Nov 2007 14:32:05 +0000 (15:32 +0100)
committerPierre Habouzit <madcoder@debian.org>
Sat, 17 Nov 2007 14:32:05 +0000 (15:32 +0100)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
CMakeLists.txt

index 10966bb..2faf161 100644 (file)
@@ -26,7 +26,7 @@ SET(PKGDATADIR "${CMAKE_INSTALL_PREFIX}/share/madmutt")
 SET(PKGDOCDIR  "${CMAKE_INSTALL_PREFIX}/share/doc/madmutt")
 SET(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc")
 SET(VERSION    "devel")
-SET(MUTTLIBS   "-lutil")
+SET(MUTTLIBS   "")
 
 ADD_DEFINITIONS("-DBINDIR=\\\"${BINDIR}\\\"")
 ADD_DEFINITIONS("-DPKGDATADIR=\\\"${PKGDATADIR}\\\"")
@@ -75,8 +75,6 @@ CHECK_INCLUDE_FILE(langinfo.h             HAVE_LANGINFO_H)
 CHECK_INCLUDE_FILE(limits.h               HAVE_LIMITS_H)
 CHECK_INCLUDE_FILE(locale.h               HAVE_LOCALE_H)
 CHECK_INCLUDE_FILE(memory.h               HAVE_MEMORY_H)
-CHECK_INCLUDE_FILE(ncurses.h              HAVE_NCURSES_H)
-CHECK_INCLUDE_FILE(ncurses/ncurses.h      HAVE_NCURSES_NCURSES_H)
 CHECK_INCLUDE_FILE(ncursesw/ncurses.h     HAVE_NCURSESW_NCURSES_H)
 CHECK_INCLUDE_FILE(regex.h                HAVE_REGEX_H)
 CHECK_INCLUDE_FILE(stdarg.h               HAVE_STDARG_H)
@@ -123,22 +121,18 @@ CHECK_FUNCTION_EXISTS(nl_langinfo HAVE_LANGINFO_CODESET)
 INCLUDE(CheckLibraryExists)
 INCLUDE(FindPkgConfig)
 
-IF(HAVE_NCURSESW_NCURSES_H)
-    SET(CMAKE_REQUIRED_INCLUDES "ncursesw/ncurses.h")
-    LIST(APPEND MUTTLIBS -lncursesw)
-ELSEIF(HAVE_NCURSES_H)
-    SET(CMAKE_REQUIRED_INCLUDES "ncurses.h")
-    LIST(APPEND MUTTLIBS  -lncurses)
-ELSEIF(HAVE_NCURSES_H OR HAVE_NCURSES_NCURSES_H)
-    SET(CMAKE_REQUIRED_INCLUDES "ncurses/ncurses.h")
-    LIST(APPEND MUTTLIBS  -lncurses)
-ELSE(HAVE_NCURSESW_NCURSES_H)
-    MESSAGE(FATAL_ERROR "could not find ncurses.h")
-ENDIF(HAVE_NCURSESW_NCURSES_H)
-SET(CMAKE_REQUIRED_LIBRARIES ${MUTTLIBS})
-CHECK_FUNCTION_EXISTS(resizeterm         HAVE_RESIZETERM)
-SET(CMAKE_REQUIRED_LIBRARIES)
-SET(CMAKE_REQUIRED_INCLUDES)
+FIND_LIBRARY(LIBUTIL NAMES util)
+IF(NOT LIBUTIL)
+    MESSAGE(FATAL_ERROR "could not find libutil")
+ENDIF(NOT LIBUTIL)
+LIST(APPEND MUTTLIBS -lutil)
+
+FIND_LIBRARY(NCURSESW NAMES ncursesw)
+IF(NOT NCURSESW OR NOT HAVE_NCURSESW_NCURSES_H)
+    MESSAGE(FATAL_ERROR "could not libncursesw")
+ENDIF(NOT NCURSESW OR NOT HAVE_NCURSESW_NCURSES_H)
+SET(CMAKE_REQUIRED_INCLUDES "ncursesw/ncurses.h")
+LIST(APPEND MUTTLIBS -lncursesw)
 
 pkg_search_module(LUA REQUIRED lua5.1)
 ADD_DEFINITIONS(${LUA_CFLAGS})