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}\\\"")
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)
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})