summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-02-18 14:21:06 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-02-18 14:21:06 +0300
commitf98132b90959ee6640e44ebdd2cc794a0d6c4bb8 (patch)
treec47297f282b7256d9d4aa373f856b4cb339b27d9 /CMakeLists.txt
parent2300ff734633aa85f5ef52d6310c7253ecc5b4bc (diff)
downloadrspamd-f98132b90959ee6640e44ebdd2cc794a0d6c4bb8.tar.gz
rspamd-f98132b90959ee6640e44ebdd2cc794a0d6c4bb8.zip
* Fix issue with -fPIC and DynaLoader
* Retab perl.c
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt19
1 files changed, 18 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 93de41c63..70e14b472 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,6 +42,14 @@ STRING(REGEX REPLACE "[\r\n]" " " PERL_CFLAGS ${PERL_CFLAGS})
STRING(REGEX REPLACE " +$" "" PERL_CFLAGS ${PERL_CFLAGS})
STRING(REGEX REPLACE "[\r\n]" " " PERL_LDFLAGS ${PERL_LDFLAGS})
STRING(REGEX REPLACE " +$" "" PERL_LDFLAGS ${PERL_LDFLAGS})
+# Handle DynaLoader
+STRING(REGEX MATCH "/[^ ]*/DynaLoader.a" PERL_DYNALOADER ${PERL_LDFLAGS})
+STRING(REGEX REPLACE "/[^ ]*/DynaLoader.a " "" PERL_LDFLAGS ${PERL_LDFLAGS})
+
+IF(PERL_DYNALOADER)
+ EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy ${PERL_DYNALOADER} ${rspamd_BINARY_DIR}/compat/libdynaloader.so)
+ LINK_DIRECTORIES(${rspamd_BINARY_DIR}/compat/)
+ENDIF(PERL_DYNALOADER)
# Lex and yacc
FIND_PROGRAM(LEX_EXECUTABLE lex)
@@ -54,6 +62,10 @@ ENDIF(NOT LEX_EXECUTABLE OR NOT YACC_EXECUTABLE)
pkg_check_modules(GLIB2 REQUIRED glib-2.0>=2.10)
pkg_check_modules(GMIME2 REQUIRED gmime-2.0)
+IF(NOT GLIB2_FOUND OR NOT GMIME2_FOUND)
+ MESSAGE(FATAL_ERROR "Error: gmime2 and glib2 are required for rspamd")
+ENDIF(NOT GLIB2_FOUND OR NOT GMIME2_FOUND)
+
# Make from ; separated list normal space separated list
# Glib2
FOREACH(arg ${GLIB2_CFLAGS})
@@ -257,13 +269,18 @@ ADD_CUSTOM_TARGET(perlxs ALL
CONFIGURE_FILE(config.h.in src/config.h)
CONFIGURE_FILE(perl/Makefile.PL.in perl/Makefile.PL)
-ADD_EXECUTABLE(rspamd ${RSPAMDSRC} ${CONTRIBSRC} ${TOKENIZERSSRC} ${CLASSIFIERSSRC} ${PLUGINSSRC} ${YACC_OUTPUT} ${LEX_OUTPUT})
+ADD_EXECUTABLE(rspamd ${RSPAMDSRC} ${CONTRIBSRC} ${TOKENIZERSSRC}
+ ${CLASSIFIERSSRC} ${PLUGINSSRC} ${YACC_OUTPUT}
+ ${LEX_OUTPUT})
SET_TARGET_PROPERTIES(rspamd PROPERTIES LINKER_LANGUAGE C)
SET_TARGET_PROPERTIES(rspamd PROPERTIES VERSION ${RSPAMD_VERSION})
SET_TARGET_PROPERTIES(rspamd PROPERTIES COMPILE_FLAGS ${PERL_CFLAGS}
LINK_FLAGS ${PERL_LDFLAGS})
TARGET_LINK_LIBRARIES(rspamd ${GLIB2_LIBRARIES})
TARGET_LINK_LIBRARIES(rspamd event)
+IF(PERL_DYNALOADER)
+ TARGET_LINK_LIBRARIES(rspamd dynaloader)
+ENDIF(PERL_DYNALOADER)
TARGET_LINK_LIBRARIES(rspamd ${GMIME2_LIBRARIES})
ADD_EXECUTABLE(test/rspamd-test ${TESTDEPENDS} ${CONTRIBSRC} ${TESTSRC})