SET(PKGDOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/madmutt")
SET(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc")
SET(VERSION "devel")
-SET(MUTTLIBS "")
+SET(MUTTLIBS)
ADD_DEFINITIONS("-DBINDIR=\\\"${BINDIR}\\\"")
ADD_DEFINITIONS("-DPKGDATADIR=\\\"${PKGDATADIR}\\\"")
# }}}
# libraries {{{
INCLUDE(CheckLibraryExists)
-INCLUDE(UsePkgConfig)
+INCLUDE(FindPkgConfig)
IF(HAVE_NCURSESW_NCURSES_H)
SET(CMAKE_REQUIRED_INCLUDES "ncursesw/ncurses.h")
- SET(MUTTLIBS "${MUTTLIBS} -lncursesw")
+ LIST(APPEND MUTTLIBS -lncursesw)
ELSEIF(HAVE_NCURSES_H)
SET(CMAKE_REQUIRED_INCLUDES "ncurses.h")
- SET(MUTTLIBS "${MUTTLIBS} -lncurses")
+ LIST(APPEND MUTTLIBS -lncurses)
ELSEIF(HAVE_NCURSES_H OR HAVE_NCURSES_NCURSES_H)
SET(CMAKE_REQUIRED_INCLUDES "ncurses/ncurses.h")
- SET(MUTTLIBS "${MUTTLIBS} -lncurses")
+ 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)
SET(CMAKE_REQUIRED_INCLUDES)
-PKGCONFIG(lua5.1 lua_INCDIR lua_LINKDIR lua_LDFLAGS lua_CFLAGS)
-MESSAGE(STATUS "found lua5.1 at: INCDIR ${lua_INCDIR}")
-INCLUDE_DIRECTORIES(${lua_INCDIR})
-ADD_DEFINITIONS(${lua_CFLAGS})
-SET(MUTTLIBS "${MUTTLIBS} ${lua_LDFLAGS}")
+pkg_search_module(LUA REQUIRED lua5.1)
+ADD_DEFINITIONS(${LUA_CFLAGS})
+LIST(APPEND MUTTLIBS ${LUA_LDFLAGS})
IF(WITH_GPGME)
XCONFIG(gpgme-config gpgme_INCDIR gpgme_LINKDIR gpgme_LDFLAGS gpgme_CFLAGS)
INCLUDE_DIRECTORIES(${gpgme_INCDIR})
ADD_DEFINITIONS(${gpgme_CFLAGS})
- SET(MUTTLIBS "${MUTTLIBS} ${gpgme_LDFLAGS}")
+ LIST(APPEND MUTTLIBS ${gpgme_LDFLAGS})
SET(HAVE_GPGME 1)
ENDIF(WITH_GPGME)
INCLUDE_DIRECTORIES(${gnutls_INCDIR})
ADD_DEFINITIONS(${gnutls_CFLAGS})
CHECK_INCLUDE_FILE(gnutls/openssl.h HAVE_GNUTLS_OPENSSL_H)
-SET(MUTTLIBS "${MUTTLIBS} ${gnutls_LDFLAGS}")
+LIST(APPEND MUTTLIBS ${gnutls_LDFLAGS})
CHECK_LIBRARY_EXISTS(sasl2 sasl_client_init "" WITH_SASL)
IF(NOT WITH_SASL)
MESSAGE(FATAL_ERROR "sasl2 not found")
ENDIF(NOT WITH_SASL)
-SET(MUTTLIBS "${MUTTLIBS} -lsasl2")
+LIST(APPEND MUTTLIBS -lsasl2)
IF(WITH_IDN)
- PKGCONFIG(libidn idn_INCDIR idn_LINKDIR idn_LDFLAGS idn_CFLAGS)
- SET(MUTTLIBS "${MUTTLIBS} ${idn_LDFLAGS}")
+ pkg_search_module(IDN REQUIRED libidn)
+ LIST(APPEND MUTTLIBS ${IDN_LDFLAGS})
SET(HAVE_LIBIDN 1)
ENDIF(WITH_IDN)
IF(NOT WITH_LOCKFILE)
MESSAGE(FATAL_ERROR "lockfile not found")
ENDIF(NOT WITH_LOCKFILE)
-SET(MUTTLIBS "${MUTTLIBS} -llockfile")
+LIST(APPEND MUTTLIBS -llockfile)
IF(USE_HCACHE)
OPTION(WITH_QDBM "Use qdbm for header caching [default: on]" ON)
SET(USE_HCACHE)
IF(WITH_QDBM)
- PKGCONFIG(qdbm qdbm_INCDIR qdbm_LINKDIR qdbm_LDFLAGS qdbm_CFLAGS)
- IF(qdbm_LDFLAGS)
- MESSAGE(STATUS "qdbm found")
- ELSE(qdbm_LDFLAGS)
- MESSAGE(FATAL_ERROR "qdbm not found")
- ENDIF(qdbm_LDFLAGS)
- INCLUDE_DIRECTORIES(${qdbm_INCDIR})
- ADD_DEFINITIONS(${qdbm_CFLAGS})
- SET(MUTTLIBS "${MUTTLIBS} ${qdbm_LDFLAGS}")
+ pkg_search_module(QDBM REQUIRED qdbm)
+ ADD_DEFINITIONS(${QDBM_CFLAGS})
+ SET(QDBM_LDFLAGS "${QDBM_LDFLAGS}")
+ # LIST(APPEND MUTTLIBS ${QDBM_LDFLAGS})
+ LIST(APPEND MUTTLIBS -lqdbm)
SET(USE_HCACHE 1)
SET(HAVE_QDBM 1)
ENDIF(WITH_QDBM)
IF(NOT GDBM)
MESSAGE(FATAL_ERROR "gdbm not found")
ENDIF(NOT GDBM)
- SET(MUTTLIBS "${MUTTLIBS} -lgdbm")
+ LIST(APPEND MUTTLIBS -lgdbm)
SET(USE_HCACHE 1)
SET(HAVE_GDBM 1)
ENDIF(NOT USE_HCACHE AND WITH_GDBM)
)
ENDIF(WITH_NNTP)
+STRING(REGEX REPLACE ";" " " MUTTLIBS "${MUTTLIBS}")
ADD_EXECUTABLE(madmutt ${madmuttsrc})
TARGET_LINK_LIBRARIES(madmutt mime sys mx lua imap ui lib)
-SET_TARGET_PROPERTIES(madmutt PROPERTIES LINK_FLAGS ${MUTTLIBS})
+SET_TARGET_PROPERTIES(madmutt PROPERTIES LINK_FLAGS "${MUTTLIBS}")
# generate_files hack {{{