aboutsummaryrefslogtreecommitdiffstats
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-02-13 18:09:43 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-02-13 18:09:43 +0000
commit0436aa53c30e43fc520d6c2ae03a40ff8752a409 (patch)
treea319369a7062271673332f72ee69c3551d3431d2 /src/CMakeLists.txt
parentaaaa145a865b83e038cb6362bdfbb72b298b895f (diff)
downloadrspamd-0436aa53c30e43fc520d6c2ae03a40ff8752a409.tar.gz
rspamd-0436aa53c30e43fc520d6c2ae03a40ff8752a409.zip
[Rework] Convert rspamd-server to a shared library
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt83
1 files changed, 53 insertions, 30 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6fbfa577d..fc2560ce6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -146,22 +146,42 @@ RAGEL_TARGET(ragel_smtp_ip
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ip_parser.rl.c)
######################### LINK SECTION ###############################
-ADD_LIBRARY(rspamd-server STATIC
- ${RSPAMD_CRYPTOBOX}
- ${RSPAMD_UTIL}
- ${RSPAMD_LUA}
- ${RSPAMD_SERVER}
- ${RSPAMD_STAT}
- ${RSPAMD_MIME}
- ${CMAKE_CURRENT_BINARY_DIR}/modules.c
- ${PLUGINSSRC}
- "${RAGEL_ragel_smtp_addr_OUTPUTS}"
- "${RAGEL_ragel_newlines_strip_OUTPUTS}"
- "${RAGEL_ragel_content_type_OUTPUTS}"
- "${RAGEL_ragel_content_disposition_OUTPUTS}"
- "${RAGEL_ragel_rfc2047_OUTPUTS}"
- "${RAGEL_ragel_smtp_date_OUTPUTS}"
- "${RAGEL_ragel_smtp_ip_OUTPUTS}")
+IF(ENABLE_STATIC MATCHES "ON")
+ ADD_LIBRARY(rspamd-server STATIC
+ ${RSPAMD_CRYPTOBOX}
+ ${RSPAMD_UTIL}
+ ${RSPAMD_LUA}
+ ${RSPAMD_SERVER}
+ ${RSPAMD_STAT}
+ ${RSPAMD_MIME}
+ ${CMAKE_CURRENT_BINARY_DIR}/modules.c
+ ${PLUGINSSRC}
+ "${RAGEL_ragel_smtp_addr_OUTPUTS}"
+ "${RAGEL_ragel_newlines_strip_OUTPUTS}"
+ "${RAGEL_ragel_content_type_OUTPUTS}"
+ "${RAGEL_ragel_content_disposition_OUTPUTS}"
+ "${RAGEL_ragel_rfc2047_OUTPUTS}"
+ "${RAGEL_ragel_smtp_date_OUTPUTS}"
+ "${RAGEL_ragel_smtp_ip_OUTPUTS}")
+ELSE()
+ ADD_LIBRARY(rspamd-server SHARED
+ ${RSPAMD_CRYPTOBOX}
+ ${RSPAMD_UTIL}
+ ${RSPAMD_LUA}
+ ${RSPAMD_SERVER}
+ ${RSPAMD_STAT}
+ ${RSPAMD_MIME}
+ ${CMAKE_CURRENT_BINARY_DIR}/modules.c
+ ${PLUGINSSRC}
+ "${RAGEL_ragel_smtp_addr_OUTPUTS}"
+ "${RAGEL_ragel_newlines_strip_OUTPUTS}"
+ "${RAGEL_ragel_content_type_OUTPUTS}"
+ "${RAGEL_ragel_content_disposition_OUTPUTS}"
+ "${RAGEL_ragel_rfc2047_OUTPUTS}"
+ "${RAGEL_ragel_smtp_date_OUTPUTS}"
+ "${RAGEL_ragel_smtp_ip_OUTPUTS}")
+ENDIF()
+
TARGET_LINK_LIBRARIES(rspamd-server rspamd-http-parser)
TARGET_LINK_LIBRARIES(rspamd-server rspamd-cdb)
TARGET_LINK_LIBRARIES(rspamd-server rspamd-lpeg)
@@ -172,33 +192,36 @@ IF (ENABLE_CLANG_PLUGIN MATCHES "ON")
ADD_DEPENDENCIES(rspamd-server rspamd-clang)
ENDIF()
-ADD_EXECUTABLE(rspamd ${RSPAMDSRC} ${CMAKE_CURRENT_BINARY_DIR}/workers.c)
-SET_TARGET_PROPERTIES(rspamd PROPERTIES LINKER_LANGUAGE C)
-SET_TARGET_PROPERTIES(rspamd PROPERTIES COMPILE_FLAGS "-DRSPAMD_MAIN")
-IF(NOT DEBIAN_BUILD)
- SET_TARGET_PROPERTIES(rspamd PROPERTIES VERSION ${RSPAMD_VERSION})
-ENDIF(NOT DEBIAN_BUILD)
-
-TARGET_LINK_LIBRARIES(rspamd rspamd-server)
IF (ENABLE_SNOWBALL MATCHES "ON")
- TARGET_LINK_LIBRARIES(rspamd stemmer)
+ TARGET_LINK_LIBRARIES(rspamd-server stemmer)
ENDIF()
-TARGET_LINK_LIBRARIES(rspamd rspamd-hiredis)
+TARGET_LINK_LIBRARIES(rspamd-server rspamd-hiredis)
IF (ENABLE_FANN MATCHES "ON")
- TARGET_LINK_LIBRARIES(rspamd fann)
+ TARGET_LINK_LIBRARIES(rspamd-server fann)
ENDIF ()
IF (ENABLE_HYPERSCAN MATCHES "ON")
- TARGET_LINK_LIBRARIES(rspamd hs)
+ TARGET_LINK_LIBRARIES(rspamd-server hs)
ENDIF()
-TARGET_LINK_LIBRARIES(rspamd rspamd-linenoise)
+TARGET_LINK_LIBRARIES(rspamd-server rspamd-linenoise)
IF(USE_CXX_LINKER)
SET_TARGET_PROPERTIES(rspamd PROPERTIES LINKER_LANGUAGE CXX)
+ SET_TARGET_PROPERTIES(rspamd-server PROPERTIES LINKER_LANGUAGE CXX)
ENDIF()
-TARGET_LINK_LIBRARIES(rspamd ${RSPAMD_REQUIRED_LIBRARIES})
+TARGET_LINK_LIBRARIES(rspamd-server ${RSPAMD_REQUIRED_LIBRARIES})
+
+ADD_EXECUTABLE(rspamd ${RSPAMDSRC} ${CMAKE_CURRENT_BINARY_DIR}/workers.c)
+SET_TARGET_PROPERTIES(rspamd PROPERTIES LINKER_LANGUAGE C)
+SET_TARGET_PROPERTIES(rspamd PROPERTIES COMPILE_FLAGS "-DRSPAMD_MAIN")
+IF(NOT DEBIAN_BUILD)
+ SET_TARGET_PROPERTIES(rspamd PROPERTIES VERSION ${RSPAMD_VERSION})
+ENDIF(NOT DEBIAN_BUILD)
+
+TARGET_LINK_LIBRARIES(rspamd rspamd-server)
INSTALL(TARGETS rspamd RUNTIME DESTINATION bin)
+INSTALL(TARGETS rspamd-server LIBRARY DESTINATION ${RSPAMD_LIBDIR})