aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-13 23:45:06 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-13 23:45:06 +0000
commit1b94a3560cea4824cff6321e02baabb6972ecfdb (patch)
tree3886c251022a04de9e1531abc4e8077cbc505d41
parent9d0fd4d7e5b5a3f3752d5c2f625fd6243da10704 (diff)
downloadrspamd-1b94a3560cea4824cff6321e02baabb6972ecfdb.tar.gz
rspamd-1b94a3560cea4824cff6321e02baabb6972ecfdb.zip
Eliminate mess with linking.
-rw-r--r--CMakeLists.txt44
-rw-r--r--src/CMakeLists.txt38
-rw-r--r--src/cdb/CMakeLists.txt1
-rw-r--r--src/client/CMakeLists.txt45
-rw-r--r--src/libcryptobox/CMakeLists.txt50
-rw-r--r--src/libmime/CMakeLists.txt30
-rw-r--r--src/libserver/CMakeLists.txt70
-rw-r--r--src/libstat/CMakeLists.txt36
-rw-r--r--src/libutil/CMakeLists.txt74
-rw-r--r--src/lua/CMakeLists.txt58
-rw-r--r--test/CMakeLists.txt37
11 files changed, 141 insertions, 342 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9038f6468..d5a3b7d61 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,7 @@
############################# INITIAL SECTION #############################################
PROJECT(rspamd C)
+ENABLE_LANGUAGE(ASM)
SET(RSPAMD_VERSION_MAJOR 0)
SET(RSPAMD_VERSION_MINOR 9)
@@ -580,8 +581,6 @@ ELSE(ENABLE_STATIC MATCHES "ON")
ENDIF(NO_SHARED MATCHES "OFF")
ENDIF(ENABLE_STATIC MATCHES "ON")
-LIST(APPEND RSPAMD_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
-
# Process with warn flags
SET(CMAKE_C_WARN_FLAGS "")
CHECK_C_COMPILER_FLAG(-Wall SUPPORT_WALL)
@@ -909,6 +908,47 @@ ENDIF(NOT HIREDIS_FOUND)
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
+LIST(APPEND RSPAMD_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
+LIST(APPEND RSPAMD_REQUIRED_LIBRARIES pcre)
+LIST(APPEND RSPAMD_REQUIRED_LIBRARIES ucl)
+LIST(APPEND RSPAMD_REQUIRED_LIBRARIES rdns)
+LIST(APPEND RSPAMD_REQUIRED_LIBRARIES ottery)
+LIST(APPEND RSPAMD_REQUIRED_LIBRARIES event)
+LIST(APPEND RSPAMD_REQUIRED_LIBRARIES xxhash)
+LIST(APPEND RSPAMD_REQUIRED_LIBRARIES siphash)
+LIST(APPEND RSPAMD_REQUIRED_LIBRARIES blake2)
+LIST(APPEND RSPAMD_REQUIRED_LIBRARIES tweetnacl)
+LIST(APPEND RSPAMD_REQUIRED_LIBRARIES sqlite3)
+LIST(APPEND RSPAMD_REQUIRED_LIBRARIES lua-ucl)
+IF(OPENSSL_FOUND)
+ LIST(APPEND RSPAMD_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
+ENDIF(OPENSSL_FOUND)
+IF(HAVE_FETCH_H)
+ LIST(APPEND RSPAMD_REQUIRED_LIBRARIES fetch)
+ENDIF(HAVE_FETCH_H)
+LIST(APPEND RSPAMD_REQUIRED_LIBRARIES event)
+IF(HAVE_LIBEVENT2)
+ LIST(APPEND RSPAMD_REQUIRED_LIBRARIES event_pthreads)
+ENDIF(HAVE_LIBEVENT2)
+IF(WITH_DB)
+ LIST(APPEND RSPAMD_REQUIRED_LIBRARIES db)
+ENDIF(WITH_DB)
+
+IF(ENABLE_LUAJIT MATCHES "ON")
+ LIST(APPEND RSPAMD_REQUIRED_LIBRARIES "${LUAJIT_LIBRARY}")
+ELSE(ENABLE_LUAJIT MATCHES "ON")
+ LIST(APPEND RSPAMD_REQUIRED_LIBRARIES "${LUA_LIBRARY}")
+ENDIF(ENABLE_LUAJIT MATCHES "ON")
+
+IF(ENABLE_GPERF_TOOLS MATCHES "ON")
+ LIST(APPEND RSPAMD_REQUIRED_LIBRARIES profiler)
+ENDIF(ENABLE_GPERF_TOOLS MATCHES "ON")
+
+LIST(APPEND RSPAMD_REQUIRED_LIBRARIES hiredis)
+IF(GLIB_COMPAT)
+ LIST(APPEND RSPAMD_REQUIRED_LIBRARIES glibadditions)
+ENDIF(GLIB_COMPAT)
+
ADD_SUBDIRECTORY(contrib/xxhash)
ADD_SUBDIRECTORY(contrib/http-parser)
ADD_SUBDIRECTORY(contrib/libottery)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d915bf551..fa2aa006e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -92,6 +92,11 @@ AddModules(MODULES_LIST WORKERS_LIST)
LIST(LENGTH PLUGINSSRC RSPAMD_MODULES_NUM)
######################### LINK SECTION ###############################
+ADD_LIBRARY(rspamd-server STATIC ${RSPAMD_UTIL} ${RSPAMD_LUA} ${RSPAMD_SERVER}
+ ${RSPAMD_STAT} ${RSPAMD_MIME} ${RSPAMD_CRYPTOBOX})
+TARGET_LINK_LIBRARIES(rspamd-server rspamd-http-parser)
+TARGET_LINK_LIBRARIES(rspamd-server rspamd-cdb)
+
ADD_EXECUTABLE(rspamd ${RSPAMDSRC} ${PLUGINSSRC})
SET_TARGET_PROPERTIES(rspamd PROPERTIES LINKER_LANGUAGE C)
SET_TARGET_PROPERTIES(rspamd PROPERTIES COMPILE_FLAGS "-DRSPAMD_MAIN")
@@ -99,42 +104,9 @@ IF(NOT DEBIAN_BUILD)
SET_TARGET_PROPERTIES(rspamd PROPERTIES VERSION ${RSPAMD_VERSION})
ENDIF(NOT DEBIAN_BUILD)
-TARGET_LINK_LIBRARIES(rspamd rspamd-stat)
-TARGET_LINK_LIBRARIES(rspamd rspamd-mime)
TARGET_LINK_LIBRARIES(rspamd rspamd-server)
-TARGET_LINK_LIBRARIES(rspamd rspamd-util)
-TARGET_LINK_LIBRARIES(rspamd rspamd-lua)
TARGET_LINK_LIBRARIES(rspamd stemmer)
-TARGET_LINK_LIBRARIES(rspamd event)
-IF(HAVE_LIBEVENT2)
- TARGET_LINK_LIBRARIES(rspamd event_pthreads)
-ENDIF(HAVE_LIBEVENT2)
-IF(WITH_DB)
- TARGET_LINK_LIBRARIES(rspamd db)
-ENDIF(WITH_DB)
-
-IF(OPENSSL_FOUND)
- TARGET_LINK_LIBRARIES(rspamd ${OPENSSL_LIBRARIES})
-ENDIF(OPENSSL_FOUND)
-IF(HAVE_FETCH_H)
- TARGET_LINK_LIBRARIES(rspamd fetch)
-ENDIF(HAVE_FETCH_H)
TARGET_LINK_LIBRARIES(rspamd ${RSPAMD_REQUIRED_LIBRARIES})
-IF(ENABLE_LUAJIT MATCHES "ON")
- TARGET_LINK_LIBRARIES(rspamd "${LUAJIT_LIBRARY}")
-ELSE(ENABLE_LUAJIT MATCHES "ON")
- TARGET_LINK_LIBRARIES(rspamd "${LUA_LIBRARY}")
-ENDIF(ENABLE_LUAJIT MATCHES "ON")
-
-IF(ENABLE_GPERF_TOOLS MATCHES "ON")
- TARGET_LINK_LIBRARIES(rspamd profiler)
-ENDIF(ENABLE_GPERF_TOOLS MATCHES "ON")
-TARGET_LINK_LIBRARIES(rspamd hiredis)
-IF(GLIB_COMPAT)
- TARGET_LINK_LIBRARIES(rspamd glibadditions)
-ENDIF(GLIB_COMPAT)
-
-
INSTALL(TARGETS rspamd RUNTIME DESTINATION bin)
diff --git a/src/cdb/CMakeLists.txt b/src/cdb/CMakeLists.txt
index 7c6e1257d..7f3850bc5 100644
--- a/src/cdb/CMakeLists.txt
+++ b/src/cdb/CMakeLists.txt
@@ -4,7 +4,6 @@ SET(CDBSRC cdb_init.c
cdb_make.c)
ADD_LIBRARY(rspamd-cdb ${LINK_TYPE} ${CDBSRC})
-TARGET_LINK_LIBRARIES(rspamd-cdb rspamd-util)
SET_TARGET_PROPERTIES(rspamd-cdb PROPERTIES VERSION ${RSPAMD_VERSION})
SET_TARGET_PROPERTIES(rspamd-cdb PROPERTIES COMPILE_FLAGS "-DRSPAMD_LIB")
IF(NO_SHARED MATCHES "OFF")
diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt
index d1e13f0ba..5bb402f0d 100644
--- a/src/client/CMakeLists.txt
+++ b/src/client/CMakeLists.txt
@@ -1,53 +1,16 @@
# Librspamdclient
SET(LIBRSPAMDCLIENTSRC rspamdclient.c)
-IF(NO_SHARED MATCHES "OFF")
- ADD_LIBRARY(rspamdclient SHARED ${LIBRSPAMDCLIENTSRC})
-ELSE(NO_SHARED MATCHES "OFF")
- ADD_LIBRARY(rspamdclient STATIC ${LIBRSPAMDCLIENTSRC})
-ENDIF(NO_SHARED MATCHES "OFF")
-ADD_LIBRARY(rspamdclient_static STATIC ${LIBRSPAMDCLIENTSRC})
-SET_TARGET_PROPERTIES(rspamdclient PROPERTIES COMPILE_FLAGS "-fPIC")
-SET_TARGET_PROPERTIES(rspamdclient_static PROPERTIES COMPILE_FLAGS "-fPIC")
-
-TARGET_LINK_LIBRARIES(rspamdclient rspamd-util)
-TARGET_LINK_LIBRARIES(rspamdclient ${RSPAMD_REQUIRED_LIBRARIES})
-
-IF(GLIB_COMPAT)
- INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/contrib/lgpl")
- TARGET_LINK_LIBRARIES(rspamdclient glibadditions)
-ENDIF(GLIB_COMPAT)
-
-IF(NO_SHARED MATCHES "OFF")
- INSTALL(TARGETS rspamdclient LIBRARY PUBLIC_HEADER
- LIBRARY DESTINATION ${LIBDIR}
- PUBLIC_HEADER DESTINATION ${INCLUDEDIR}
- ARCHIVE DESTINATION ${LIBDIR})
-ENDIF(NO_SHARED MATCHES "OFF")
-
# rspamc
SET(RSPAMCSRC rspamc.c)
-ADD_EXECUTABLE(rspamc ${RSPAMCSRC})
+ADD_EXECUTABLE(rspamc ${RSPAMCSRC} ${LIBRSPAMDCLIENTSRC})
SET_TARGET_PROPERTIES(rspamc PROPERTIES COMPILE_FLAGS "-I${CMAKE_SOURCE_DIR}/lib")
-TARGET_LINK_LIBRARIES(rspamc rspamd-util)
-IF(ENABLE_STATIC MATCHES "ON")
- TARGET_LINK_LIBRARIES(rspamc rspamdclient_static)
-ELSE(ENABLE_STATIC MATCHES "ON")
- TARGET_LINK_LIBRARIES(rspamc rspamdclient)
-ENDIF(ENABLE_STATIC MATCHES "ON")
-IF(GLIB_COMPAT)
- TARGET_LINK_LIBRARIES(rspamc glibadditions)
-ENDIF(GLIB_COMPAT)
-IF(OPENSSL_FOUND)
- TARGET_LINK_LIBRARIES(rspamc ${OPENSSL_LIBRARIES})
-ENDIF(OPENSSL_FOUND)
+TARGET_LINK_LIBRARIES(rspamc rspamd-server)
TARGET_LINK_LIBRARIES(rspamc ${RSPAMD_REQUIRED_LIBRARIES})
-IF(ENABLE_GPERF_TOOLS MATCHES "ON")
- TARGET_LINK_LIBRARIES(rspamc profiler)
-ENDIF(ENABLE_GPERF_TOOLS MATCHES "ON")
+
IF(NOT DEBIAN_BUILD)
-SET_TARGET_PROPERTIES(rspamc PROPERTIES VERSION ${RSPAMD_VERSION})
+ SET_TARGET_PROPERTIES(rspamc PROPERTIES VERSION ${RSPAMD_VERSION})
ENDIF(NOT DEBIAN_BUILD)
INSTALL(TARGETS rspamc RUNTIME DESTINATION bin)
diff --git a/src/libcryptobox/CMakeLists.txt b/src/libcryptobox/CMakeLists.txt
index fc0a3f477..729f93854 100644
--- a/src/libcryptobox/CMakeLists.txt
+++ b/src/libcryptobox/CMakeLists.txt
@@ -3,12 +3,12 @@ INCLUDE(AsmOp.cmake)
TARGET_ARCHITECTURE(ARCH)
-SET(CHACHASRC chacha20/chacha.c chacha20/ref.c)
-SET(POLYSRC poly1305/poly1305.c)
+SET(CHACHASRC ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/chacha.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/ref.c)
+SET(POLYSRC ${CMAKE_CURRENT_SOURCE_DIR}/poly1305/poly1305.c)
# For now we support only x86_64 architecture with optimizations
IF(${ARCH} STREQUAL "x86_64")
- ENABLE_LANGUAGE(ASM)
ASM_OP(HAVE_AVX2 "vpaddq %ymm0, %ymm0, %ymm0" "avx2")
ASM_OP(HAVE_AVX "vpaddq %xmm0, %xmm0, %xmm0" "avx")
ASM_OP(HAVE_SSE2 "pmuludq %xmm0, %xmm0" "sse2")
@@ -29,45 +29,29 @@ IF(${ARCH} STREQUAL "x86_64")
CONFIGURE_FILE(platform_config.h.in platform_config.h)
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}")
- SET(CURVESRC curve25519/curve25519-donna-c64.c)
- SET(POLYSRC ${POLYSRC} poly1305/ref-64.c)
+ SET(CURVESRC ${CMAKE_CURRENT_SOURCE_DIR}/curve25519/curve25519-donna-c64.c)
+ SET(POLYSRC ${POLYSRC} ${CMAKE_CURRENT_SOURCE_DIR}/poly1305/ref-64.c)
ELSEIF(${ARCH} STREQUAL "i386")
- SET(POLYSRC ${POLYSRC} poly1305/ref-32.c)
- SET(CURVESRC curve25519/curve25519-donna.c)
+ SET(POLYSRC ${POLYSRC} ${CMAKE_CURRENT_SOURCE_DIR}/poly1305/ref-32.c)
+ SET(CURVESRC ${CMAKE_CURRENT_SOURCE_DIR}/curve25519/curve25519-donna.c)
ELSE()
- SET(CURVESRC curve25519/ref.c)
- SET(POLYSRC ${POLYSRC} poly1305/ref-32.c)
+ SET(CURVESRC ${CMAKE_CURRENT_SOURCE_DIR}/curve25519/ref.c)
+ SET(POLYSRC ${POLYSRC} ${CMAKE_CURRENT_SOURCE_DIR}/poly1305/ref-32.c)
ENDIF()
IF(HAVE_AVX2)
- SET(CHACHASRC ${CHACHASRC} chacha20/avx2.S)
- SET(POLYSRC ${POLYSRC} poly1305/avx2.S)
+ SET(CHACHASRC ${CHACHASRC} ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/avx2.S)
+ SET(POLYSRC ${POLYSRC} ${CMAKE_CURRENT_SOURCE_DIR}/poly1305/avx2.S)
ENDIF(HAVE_AVX2)
IF(HAVE_AVX)
- SET(CHACHASRC ${CHACHASRC} chacha20/avx.S)
- SET(POLYSRC ${POLYSRC} poly1305/avx.S)
+ SET(CHACHASRC ${CHACHASRC} ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/avx.S)
+ SET(POLYSRC ${POLYSRC} ${CMAKE_CURRENT_SOURCE_DIR}/poly1305/avx.S)
ENDIF(HAVE_AVX)
IF(HAVE_SSE2)
- SET(CHACHASRC ${CHACHASRC} chacha20/sse2.S)
- SET(POLYSRC ${POLYSRC} poly1305/sse2.S)
+ SET(CHACHASRC ${CHACHASRC} ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/sse2.S)
+ SET(POLYSRC ${POLYSRC} ${CMAKE_CURRENT_SOURCE_DIR}/poly1305/sse2.S)
ENDIF(HAVE_SSE2)
-SET(LIBCRYPTOBOXSRC cryptobox.c)
+SET(LIBCRYPTOBOXSRC ${CMAKE_CURRENT_SOURCE_DIR}/cryptobox.c)
-ADD_LIBRARY(rspamd-cryptobox ${LINK_TYPE} ${LIBCRYPTOBOXSRC}
- ${CHACHASRC} ${POLYSRC} ${CURVESRC})
-IF(NOT DEBIAN_BUILD)
- SET_TARGET_PROPERTIES(rspamd-cryptobox PROPERTIES VERSION ${RSPAMD_VERSION})
-ENDIF(NOT DEBIAN_BUILD)
-SET_TARGET_PROPERTIES(rspamd-cryptobox PROPERTIES LINKER_LANGUAGE C COMPILE_FLAGS "-DRSPAMD_LIB")
-
-IF(CMAKE_COMPILER_IS_GNUCC)
-SET_TARGET_PROPERTIES(rspamd-cryptobox PROPERTIES COMPILE_FLAGS "-DRSPAMD_LIB -fno-strict-aliasing")
-ENDIF(CMAKE_COMPILER_IS_GNUCC)
-TARGET_LINK_LIBRARIES(rspamd-cryptobox ottery)
-
-IF(NO_SHARED MATCHES "OFF")
- INSTALL(TARGETS rspamd-cryptobox
- LIBRARY DESTINATION ${LIBDIR}
- PUBLIC_HEADER DESTINATION ${INCLUDEDIR})
-ENDIF(NO_SHARED MATCHES "OFF") \ No newline at end of file
+SET(RSPAMD_CRYPTOBOX ${LIBCRYPTOBOXSRC} ${CHACHASRC} ${POLYSRC} ${CURVESRC} PARENT_SCOPE) \ No newline at end of file
diff --git a/src/libmime/CMakeLists.txt b/src/libmime/CMakeLists.txt
index 94f2f6e89..6d233ab1a 100644
--- a/src/libmime/CMakeLists.txt
+++ b/src/libmime/CMakeLists.txt
@@ -1,28 +1,12 @@
# Librspamd mime
SET(LIBRSPAMDMIMESRC
- expressions.c
- filter.c
- images.c
- message.c
- smtp_utils.c
- smtp_proto.c)
+ ${CMAKE_CURRENT_SOURCE_DIR}/expressions.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/filter.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/images.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/message.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/smtp_utils.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/smtp_proto.c)
# Librspamdmime
ADD_LIBRARY(rspamd-mime ${LINK_TYPE} ${LIBRSPAMDMIMESRC})
-IF(NOT DEBIAN_BUILD)
-SET_TARGET_PROPERTIES(rspamd-mime PROPERTIES VERSION ${RSPAMD_VERSION})
-ENDIF(NOT DEBIAN_BUILD)
-SET_TARGET_PROPERTIES(rspamd-mime PROPERTIES LINKER_LANGUAGE C)
-SET_TARGET_PROPERTIES(rspamd-mime PROPERTIES COMPILE_FLAGS "-DRSPAMD_LIB")
-TARGET_LINK_LIBRARIES(rspamd-mime rspamd-server)
-TARGET_LINK_LIBRARIES(rspamd-mime rspamd-stat)
-TARGET_LINK_LIBRARIES(rspamd-mime rspamd-util)
-IF(CMAKE_COMPILER_IS_GNUCC)
- SET_TARGET_PROPERTIES(rspamd-mime PROPERTIES COMPILE_FLAGS "-DRSPAMD_LIB -fno-strict-aliasing")
-ENDIF(CMAKE_COMPILER_IS_GNUCC)
-
-IF(NO_SHARED MATCHES "OFF")
- INSTALL(TARGETS rspamd-mime
- LIBRARY DESTINATION ${LIBDIR}
- PUBLIC_HEADER DESTINATION ${INCLUDEDIR})
-ENDIF(NO_SHARED MATCHES "OFF") \ No newline at end of file
+SET(RSPAMD_MIME ${LIBRSPAMDMIMESRC} PARENT_SCOPE) \ No newline at end of file
diff --git a/src/libserver/CMakeLists.txt b/src/libserver/CMakeLists.txt
index 93662b6b7..4edbe054d 100644
--- a/src/libserver/CMakeLists.txt
+++ b/src/libserver/CMakeLists.txt
@@ -1,56 +1,22 @@
# Librspamdserver
SET(LIBRSPAMDSERVERSRC
- buffer.c
- cfg_utils.c
- cfg_rcl.c
- dkim.c
- dns.c
- dynamic_cfg.c
- events.c
- fuzzy_backend.c
- html.c
- protocol.c
- proxy.c
- roll_history.c
- spf.c
- symbols_cache.c
- task.c
- url.c
- worker_util.c)
+ ${CMAKE_CURRENT_SOURCE_DIR}/buffer.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/cfg_utils.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/cfg_rcl.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/dkim.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/dns.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/dynamic_cfg.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/events.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/fuzzy_backend.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/html.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/protocol.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/proxy.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/roll_history.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/spf.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/symbols_cache.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/task.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/url.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/worker_util.c)
# Librspamd-server
-
-#IF(WITH_DB)
-# LIST(APPEND LIBRSPAMDSERVERSRC kvstorage_bdb.c)
-#ENDIF(WITH_DB)
-#IF(WITH_SQLITE)
-# LIST(APPEND LIBRSPAMDSERVERSRC kvstorage_sqlite.c)
-#ENDIF(WITH_SQLITE)
-
-ADD_LIBRARY(rspamd-server ${LINK_TYPE} ${LIBRSPAMDSERVERSRC})
-IF(NOT DEBIAN_BUILD)
- SET_TARGET_PROPERTIES(rspamd-server PROPERTIES VERSION ${RSPAMD_VERSION})
-ENDIF(NOT DEBIAN_BUILD)
-SET_TARGET_PROPERTIES(rspamd-server PROPERTIES LINKER_LANGUAGE C COMPILE_FLAGS "-DRSPAMD_LIB")
-TARGET_LINK_LIBRARIES(rspamd-server rspamd-lua)
-TARGET_LINK_LIBRARIES(rspamd-server rspamd-cdb)
-TARGET_LINK_LIBRARIES(rspamd-server rspamd-util)
-TARGET_LINK_LIBRARIES(rspamd-server sqlite3)
-TARGET_LINK_LIBRARIES(rspamd-server rdns)
-IF(CMAKE_COMPILER_IS_GNUCC)
-SET_TARGET_PROPERTIES(rspamd-server PROPERTIES COMPILE_FLAGS "-DRSPAMD_LIB -fno-strict-aliasing")
-ENDIF(CMAKE_COMPILER_IS_GNUCC)
-
-IF(WITH_DB)
- TARGET_LINK_LIBRARIES(rspamd-server db)
-ENDIF(WITH_DB)
-
-IF(OPENSSL_FOUND)
- TARGET_LINK_LIBRARIES(rspamd-server ${OPENSSL_LIBRARIES})
-ENDIF(OPENSSL_FOUND)
-
-IF(NO_SHARED MATCHES "OFF")
- INSTALL(TARGETS rspamd-server
- LIBRARY DESTINATION ${LIBDIR}
- PUBLIC_HEADER DESTINATION ${INCLUDEDIR})
-ENDIF(NO_SHARED MATCHES "OFF")
+SET(RSPAMD_SERVER ${LIBRSPAMDSERVERSRC} PARENT_SCOPE)
diff --git a/src/libstat/CMakeLists.txt b/src/libstat/CMakeLists.txt
index fc9450140..5d7184316 100644
--- a/src/libstat/CMakeLists.txt
+++ b/src/libstat/CMakeLists.txt
@@ -1,37 +1,19 @@
# Librspamdserver
-SET(LIBSTATSRC stat_config.c
- stat_process.c)
+SET(LIBSTATSRC ${CMAKE_CURRENT_SOURCE_DIR}/stat_config.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/stat_process.c)
-SET(TOKENIZERSSRC tokenizers/tokenizers.c
- tokenizers/osb.c)
+SET(TOKENIZERSSRC ${CMAKE_CURRENT_SOURCE_DIR}/tokenizers/tokenizers.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/tokenizers/osb.c)
-SET(CLASSIFIERSSRC classifiers/bayes.c)
+SET(CLASSIFIERSSRC ${CMAKE_CURRENT_SOURCE_DIR}/classifiers/bayes.c)
-SET(BACKENDSSRC backends/mmaped_file.c)
+SET(BACKENDSSRC ${CMAKE_CURRENT_SOURCE_DIR}/backends/mmaped_file.c)
-SET(CACHESSRC learn_cache/sqlite3_cache.c)
+SET(CACHESSRC ${CMAKE_CURRENT_SOURCE_DIR}/learn_cache/sqlite3_cache.c)
-ADD_LIBRARY(rspamd-stat ${LINK_TYPE} ${LIBSTATSRC}
+SET(RSPAMD_STAT ${LIBSTATSRC}
${TOKENIZERSSRC}
${CLASSIFIERSSRC}
${BACKENDSSRC}
- ${CACHESSRC})
+ ${CACHESSRC} PARENT_SCOPE)
-IF(NOT DEBIAN_BUILD)
- SET_TARGET_PROPERTIES(rspamd-stat PROPERTIES VERSION ${RSPAMD_VERSION})
-ENDIF(NOT DEBIAN_BUILD)
-
-SET_TARGET_PROPERTIES(rspamd-stat PROPERTIES LINKER_LANGUAGE C COMPILE_FLAGS "-DRSPAMD_LIB")
-TARGET_LINK_LIBRARIES(rspamd-stat rspamd-server)
-TARGET_LINK_LIBRARIES(rspamd-stat sqlite3)
-
-IF(CMAKE_COMPILER_IS_GNUCC)
-SET_TARGET_PROPERTIES(rspamd-stat PROPERTIES COMPILE_FLAGS "-DRSPAMD_LIB -fno-strict-aliasing")
-ENDIF(CMAKE_COMPILER_IS_GNUCC)
-
-
-IF(NO_SHARED MATCHES "OFF")
- INSTALL(TARGETS rspamd-stat
- LIBRARY DESTINATION ${LIBDIR}
- PUBLIC_HEADER DESTINATION ${INCLUDEDIR})
-ENDIF(NO_SHARED MATCHES "OFF")
diff --git a/src/libutil/CMakeLists.txt b/src/libutil/CMakeLists.txt
index ae650f55e..e7ebe2a47 100644
--- a/src/libutil/CMakeLists.txt
+++ b/src/libutil/CMakeLists.txt
@@ -1,57 +1,23 @@
# Librspamd-util
SET(LIBRSPAMDUTILSRC
- addr.c
- aio_event.c
- bloom.c
- diff.c
- fstring.c
- fuzzy.c
- hash.c
- http.c
- keypairs_cache.c
- logger.c
- map.c
- mem_pool.c
- printf.c
- radix.c
- rrd.c
- shingles.c
- trie.c
- upstream.c
- util.c)
+ ${CMAKE_CURRENT_SOURCE_DIR}/addr.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/aio_event.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/bloom.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/diff.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/fstring.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/fuzzy.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/hash.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/http.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/keypairs_cache.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/logger.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/map.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/mem_pool.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/printf.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/radix.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/rrd.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/shingles.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/trie.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/upstream.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/util.c)
# Rspamdutil
-ADD_LIBRARY(rspamd-util ${LINK_TYPE} ${LIBRSPAMDUTILSRC})
-IF(CMAKE_COMPILER_IS_GNUCC)
-SET_TARGET_PROPERTIES(rspamd-util PROPERTIES COMPILE_FLAGS "-fno-strict-aliasing")
-ENDIF(CMAKE_COMPILER_IS_GNUCC)
-
-TARGET_LINK_LIBRARIES(rspamd-util ${RSPAMD_REQUIRED_LIBRARIES})
-TARGET_LINK_LIBRARIES(rspamd-util pcre)
-TARGET_LINK_LIBRARIES(rspamd-util ucl)
-TARGET_LINK_LIBRARIES(rspamd-util ottery)
-TARGET_LINK_LIBRARIES(rspamd-util rspamd-http-parser)
-TARGET_LINK_LIBRARIES(rspamd-util event)
-TARGET_LINK_LIBRARIES(rspamd-util xxhash)
-TARGET_LINK_LIBRARIES(rspamd-util siphash)
-TARGET_LINK_LIBRARIES(rspamd-util blake2)
-TARGET_LINK_LIBRARIES(rspamd-util tweetnacl)
-TARGET_LINK_LIBRARIES(rspamd-util rspamd-cryptobox)
-TARGET_LINK_LIBRARIES(rspamd-util rdns)
-IF(OPENSSL_FOUND)
- TARGET_LINK_LIBRARIES(rspamd-util ${OPENSSL_LIBRARIES})
-ENDIF(OPENSSL_FOUND)
-
-IF(NOT DEBIAN_BUILD)
-SET_TARGET_PROPERTIES(rspamd-util PROPERTIES VERSION ${RSPAMD_VERSION})
-ENDIF(NOT DEBIAN_BUILD)
-
-IF(GLIB_COMPAT)
- INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/contrib/lgpl")
- TARGET_LINK_LIBRARIES(rspamd-util glibadditions)
-ENDIF(GLIB_COMPAT)
-
-IF(NO_SHARED MATCHES "OFF")
- INSTALL(TARGETS rspamd-util
- LIBRARY DESTINATION ${LIBDIR}
- PUBLIC_HEADER DESTINATION include)
-ENDIF(NO_SHARED MATCHES "OFF") \ No newline at end of file
+SET(RSPAMD_UTIL ${LIBRSPAMDUTILSRC} PARENT_SCOPE) \ No newline at end of file
diff --git a/src/lua/CMakeLists.txt b/src/lua/CMakeLists.txt
index b3d8bc340..fbf2733d0 100644
--- a/src/lua/CMakeLists.txt
+++ b/src/lua/CMakeLists.txt
@@ -1,42 +1,20 @@
# Lua support makefile
-SET(LUASRC lua_common.c
- lua_task.c
- lua_config.c
- lua_classifier.c
- lua_cfg_file.c
- lua_regexp.c
- lua_cdb.c
- lua_xmlrpc.c
- lua_http.c
- lua_redis.c
- lua_upstream.c
- lua_mempool.c
- lua_session.c
- lua_buffer.c
- lua_dns.c
- lua_rsa.c
- lua_ip.c)
+SET(LUASRC ${CMAKE_CURRENT_SOURCE_DIR}/lua_common.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/lua_task.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/lua_config.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/lua_classifier.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/lua_cfg_file.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/lua_regexp.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/lua_cdb.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/lua_xmlrpc.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/lua_http.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/lua_redis.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/lua_upstream.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/lua_mempool.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/lua_session.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/lua_buffer.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/lua_dns.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/lua_rsa.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/lua_ip.c)
-ADD_LIBRARY(rspamd-lua ${LINK_TYPE} ${LUASRC})
-SET_TARGET_PROPERTIES(rspamd-lua PROPERTIES VERSION ${RSPAMD_VERSION})
-TARGET_LINK_LIBRARIES(rspamd-lua rspamd-util)
-TARGET_LINK_LIBRARIES(rspamd-lua hiredis)
-IF(ENABLE_LUAJIT MATCHES "ON")
- TARGET_LINK_LIBRARIES(rspamd-lua "${LUAJIT_LIBRARY}")
-ELSE(ENABLE_LUAJIT MATCHES "ON")
- TARGET_LINK_LIBRARIES(rspamd-lua "${LUA_LIBRARY}")
-ENDIF(ENABLE_LUAJIT MATCHES "ON")
-TARGET_LINK_LIBRARIES(rspamd-lua ${GLIB2_LIBRARIES})
-TARGET_LINK_LIBRARIES(rspamd-lua lua-ucl)
-IF(GMIME24)
- TARGET_LINK_LIBRARIES(rspamd-lua ${GMIME24_LIBRARIES})
-ELSE(GMIME24)
- TARGET_LINK_LIBRARIES(rspamd-lua ${GMIME2_LIBRARIES})
-ENDIF(GMIME24)
-TARGET_LINK_LIBRARIES(rspamd-lua rspamd-cdb)
-SET_TARGET_PROPERTIES(rspamd-lua PROPERTIES COMPILE_FLAGS "-DRSPAMD_LIB")
-IF(NO_SHARED MATCHES "OFF")
- INSTALL(TARGETS rspamd-lua
- LIBRARY DESTINATION ${LIBDIR}
- PUBLIC_HEADER DESTINATION ${INCLUDEDIR})
-ENDIF(NO_SHARED MATCHES "OFF") \ No newline at end of file
+SET(RSPAMD_LUA ${LUASRC} PARENT_SCOPE) \ No newline at end of file
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 99c825199..f5743bd2f 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -17,40 +17,5 @@ ADD_EXECUTABLE(rspamd-test EXCLUDE_FROM_ALL ${TESTSRC})
SET_TARGET_PROPERTIES(rspamd-test PROPERTIES LINKER_LANGUAGE C)
SET_TARGET_PROPERTIES(rspamd-test PROPERTIES COMPILE_FLAGS "-DRSPAMD_TEST")
-TARGET_LINK_LIBRARIES(rspamd-test rspamd-stat)
-TARGET_LINK_LIBRARIES(rspamd-test rspamd-mime)
TARGET_LINK_LIBRARIES(rspamd-test rspamd-server)
-TARGET_LINK_LIBRARIES(rspamd-test rspamd-util)
-TARGET_LINK_LIBRARIES(rspamd-test rspamd-lua)
-TARGET_LINK_LIBRARIES(rspamd-test rspamd-cryptobox)
-TARGET_LINK_LIBRARIES(rspamd-test stemmer)
-
-TARGET_LINK_LIBRARIES(rspamd-test event)
-IF(HAVE_LIBEVENT2)
- TARGET_LINK_LIBRARIES(rspamd-test event_pthreads)
-ENDIF(HAVE_LIBEVENT2)
-IF(WITH_DB)
- TARGET_LINK_LIBRARIES(rspamd-test db)
-ENDIF(WITH_DB)
-
-IF(OPENSSL_FOUND)
- TARGET_LINK_LIBRARIES(rspamd-test ${OPENSSL_LIBRARIES})
-ENDIF(OPENSSL_FOUND)
-IF(HAVE_FETCH_H)
- TARGET_LINK_LIBRARIES(rspamd-test fetch)
-ENDIF(HAVE_FETCH_H)
-TARGET_LINK_LIBRARIES(rspamd-test ${RSPAMD_REQUIRED_LIBRARIES})
-
-IF(ENABLE_LUAJIT MATCHES "ON")
- TARGET_LINK_LIBRARIES(rspamd-test "${LUAJIT_LIBRARY}")
-ELSE(ENABLE_LUAJIT MATCHES "ON")
- TARGET_LINK_LIBRARIES(rspamd-test "${LUA_LIBRARY}")
-ENDIF(ENABLE_LUAJIT MATCHES "ON")
-
-IF(ENABLE_GPERF_TOOLS MATCHES "ON")
- TARGET_LINK_LIBRARIES(rspamd-test profiler)
-ENDIF(ENABLE_GPERF_TOOLS MATCHES "ON")
-TARGET_LINK_LIBRARIES(rspamd-test hiredis)
-IF(GLIB_COMPAT)
- TARGET_LINK_LIBRARIES(rspamd-test glibadditions)
-ENDIF(GLIB_COMPAT) \ No newline at end of file
+TARGET_LINK_LIBRARIES(rspamd-test ${RSPAMD_REQUIRED_LIBRARIES}) \ No newline at end of file