aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-07-29 20:35:00 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-07-29 20:35:00 +0400
commit4c4773d96b1b2a157009590908fce032696281c5 (patch)
treec9709f5a21b4eafbfee04327884cb5c6d39006e4 /CMakeLists.txt
parent513e304bc6255492eee5c78c97d222037087f429 (diff)
downloadrspamd-4c4773d96b1b2a157009590908fce032696281c5.tar.gz
rspamd-4c4773d96b1b2a157009590908fce032696281c5.zip
* Fix build under CentOS 5 with old glib 2.12
* Fix build of rspamd with CMAKE_BINARY_DIR differs from CMAKE_SOURCE_DIR Rework include style.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt57
1 files changed, 44 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 667bd223b..84dbe52ef 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -113,8 +113,14 @@ ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE -DLINUX")
IF(CMAKE_INSTALL_PREFIX)
- SET(ETC_PREFIX "${CMAKE_INSTALL_PREFIX}/etc")
- SET(MAN_PREFIX "${CMAKE_INSTALL_PREFIX}/etc")
+ IF(NOT ETC_PREFIX)
+ SET(ETC_PREFIX "${CMAKE_INSTALL_PREFIX}/etc")
+ ENDIF(NOT ETC_PREFIX)
+
+ IF(NOT MAN_PREFIX)
+ SET(MAN_PREFIX "${CMAKE_INSTALL_PREFIX}/share/man")
+ ENDIF(NOT MAN_PREFIX)
+
SET(PREFIX "${CMAKE_INSTALL_PREFIX}")
ELSE(CMAKE_INSTALL_PREFIX)
IF(NOT ETC_PREFIX)
@@ -204,11 +210,21 @@ ELSE(NOT LUA_FOUND)
INCLUDE_DIRECTORIES("${LUA_INCLUDE_DIR}")
ENDIF(NOT LUA_FOUND)
+# Check and link to pcre
+pkg_check_modules(PCRE REQUIRED libpcre)
+IF(PCRE_INCLUDE_DIRS)
+ INCLUDE_DIRECTORIES("${PCRE_INCLUDE_DIRS}")
+ENDIF(PCRE_INCLUDE_DIRS)
+IF(PCRE_LIBRARY_DIRS)
+ LINK_DIRECTORIES("${PCRE_LIBRARY_DIRS}")
+ENDIF(PCRE_LIBRARY_DIRS)
+LIST(APPEND CMAKE_REQUIRED_LIBRARIES "pcre")
+
IF(ENABLE_STATIC MATCHES "ON")
- pkg_check_modules(GLIB2 REQUIRED glib-2.0>=2.16)
- pkg_check_modules(PCRE REQUIRED libpcre)
+ pkg_check_modules(GLIB2 REQUIRED glib-2.0>=2.12)
ELSE(ENABLE_STATIC MATCHES "ON")
- pkg_check_modules(GLIB2 REQUIRED glib-2.0>=2.16 gmodule-2.0)
+ pkg_check_modules(GLIB2 REQUIRED glib-2.0>=2.12 gmodule-2.0)
+ SET(GLIB2_VERSION "${GLIB2_glib-2.0_VERSION}")
ENDIF(ENABLE_STATIC MATCHES "ON")
pkg_check_modules(GMIME2 gmime-2.0)
@@ -230,8 +246,12 @@ IF(NOT GMIME2_FOUND OR FORCE_GMIME24)
SET(GMIME_LDFLAGS "${GMIME_LDFLAGS} ${arg}")
ENDFOREACH(arg ${GMIME24_LDFLAGS})
ENDIF(ENABLE_STATIC MATCHES "ON")
- INCLUDE_DIRECTORIES(${GMIME24_INCLUDE_DIRS})
- LINK_DIRECTORIES(${GMIME24_LIBRARY_DIRS})
+ IF(GMIME24_INCLUDE_DIRS)
+ INCLUDE_DIRECTORIES(${GMIME24_INCLUDE_DIRS})
+ ENDIF(GMIME24_INCLUDE_DIRS)
+ IF(GMIME24_LIBRARY_DIRS)
+ LINK_DIRECTORIES(${GMIME24_LIBRARY_DIRS})
+ ENDIF(GMIME24_LIBRARY_DIRS)
ELSE(NOT GMIME2_FOUND OR FORCE_GMIME24)
# Gmime2
FOREACH(arg ${GMIME2_CFLAGS})
@@ -247,8 +267,12 @@ ELSE(NOT GMIME2_FOUND OR FORCE_GMIME24)
SET(GMIME_LDFLAGS "${GMIME_LDFLAGS} ${arg}")
ENDFOREACH(arg ${GMIME2_LDFLAGS})
ENDIF(ENABLE_STATIC MATCHES "ON")
- INCLUDE_DIRECTORIES(${GMIME2_INCLUDE_DIRS})
- LINK_DIRECTORIES(${GMIME2_LIBRARY_DIRS})
+ IF(GMIME2_INCLUDE_DIRS)
+ INCLUDE_DIRECTORIES(${GMIME2_INCLUDE_DIRS})
+ ENDIF(GMIME2_INCLUDE_DIRS)
+ IF(GMIME2_LIBRARY_DIRS)
+ LINK_DIRECTORIES(${GMIME2_LIBRARY_DIRS})
+ ENDIF(GMIME2_LIBRARY_DIRS)
ENDIF(NOT GMIME2_FOUND OR FORCE_GMIME24)
# Make from ; separated list normal space separated list
@@ -550,6 +574,7 @@ ENDIF(HG)
################################ SOURCES SECTION ###########################
+INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/src" "${CMAKE_BINARY_DIR}/src")
SET(RSPAMDSRC src/modules.c
src/controller.c
@@ -575,8 +600,13 @@ SET(PLUGINSSRC src/plugins/surbl.c
src/plugins/spf.c)
ADD_CUSTOM_COMMAND(OUTPUT src/modules.c
- COMMAND ../utils/gen-modules.sh ${PLUGINSSRC}
- WORKING_DIRECTORY src)
+ COMMAND ${CMAKE_SOURCE_DIR}/utils/gen-modules.sh ${PLUGINSSRC}
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src)
+
+ADD_SUBDIRECTORY(contrib/lgpl)
+IF(GLIB_COMPAT)
+ INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/contrib/lgpl")
+ENDIF(GLIB_COMPAT)
ADD_SUBDIRECTORY(src/lua)
ADD_SUBDIRECTORY(src/json)
@@ -588,13 +618,11 @@ ADD_SUBDIRECTORY(src/client)
ADD_SUBDIRECTORY(utils)
ADD_SUBDIRECTORY(test)
-
LIST(LENGTH PLUGINSSRC RSPAMD_MODULES_NUM)
############################ TARGETS SECTION ###############################
-
CONFIGURE_FILE(config.h.in src/config.h)
CONFIGURE_FILE(contrib/exim/local_scan.c.in contrib/exim/local_scan_rspamd.c @ONLY)
CONFIGURE_FILE(conf/rspamd-basic.xml.in conf/rspamd.xml.sample @ONLY)
@@ -635,6 +663,9 @@ IF(ENABLE_GPERF_TOOLS MATCHES "ON")
TARGET_LINK_LIBRARIES(rspamd profiler)
ENDIF(ENABLE_GPERF_TOOLS MATCHES "ON")
+IF(GLIB_COMPAT)
+ TARGET_LINK_LIBRARIES(rspamd glibadditions)
+ENDIF(GLIB_COMPAT)
##################### INSTALLATION ##########################################