diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-17 22:06:14 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-17 22:06:14 +0100 |
commit | 92ba37c087674acafedb042bdb85433871dd4f44 (patch) | |
tree | 6ec7c77f2efcc0439a9f54e647c10bd801ab2101 /src/CMakeLists.txt | |
parent | 8eab240ec7a152df5837547c73ce717351e07ba1 (diff) | |
download | rspamd-92ba37c087674acafedb042bdb85433871dd4f44.tar.gz rspamd-92ba37c087674acafedb042bdb85433871dd4f44.zip |
Fix tests build.
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r-- | src/CMakeLists.txt | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index de418e172..487dac289 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -MACRO(_AddModulesForced MLIST WLIST) +MACRO(_AddModulesForced MLIST) # Generate unique string for this build STRING(RANDOM LENGTH 8 _MODULES_ID) SET(MODULES_ID ${_MODULES_ID} CACHE INTERNAL "Modules ID" FORCE) @@ -8,9 +8,7 @@ MACRO(_AddModulesForced MLIST WLIST) # Handle even old cmake LIST(LENGTH ${MLIST} MLIST_COUNT) - LIST(LENGTH ${WLIST} WLIST_COUNT) MATH(EXPR MLIST_MAX ${MLIST_COUNT}-1) - MATH(EXPR WLIST_MAX ${WLIST_COUNT}-1) FOREACH(MOD_IDX RANGE ${MLIST_MAX}) LIST(GET ${MLIST} ${MOD_IDX} MOD) @@ -25,23 +23,33 @@ MACRO(_AddModulesForced MLIST WLIST) ENDFOREACH(MOD_IDX RANGE ${MLIST_MAX}) FILE(APPEND "${MODULES_C}" "NULL\n};\n") +ENDMACRO(_AddModulesForced MLIST) + +MACRO(_AddWorkersForced WLIST) + SET(WORKERS_C "${CMAKE_CURRENT_BINARY_DIR}/workers.c") + FILE(WRITE "${WORKERS_C}" + "#include \"config.h\"\n") + # Handle even old cmake + LIST(LENGTH ${WLIST} WLIST_COUNT) + MATH(EXPR WLIST_MAX ${WLIST_COUNT}-1) FOREACH(MOD_IDX RANGE ${WLIST_MAX}) LIST(GET ${WLIST} ${MOD_IDX} WRK) - FILE(APPEND "${MODULES_C}" "extern worker_t ${WRK}_worker;\n") + FILE(APPEND "${WORKERS_C}" "extern worker_t ${WRK}_worker;\n") ENDFOREACH(MOD_IDX RANGE ${WLIST_MAX}) - FILE(APPEND "${MODULES_C}" "\n\nworker_t *workers[] = {\n") + FILE(APPEND "${WORKERS_C}" "\n\nworker_t *workers[] = {\n") FOREACH(MOD_IDX RANGE ${WLIST_MAX}) LIST(GET ${WLIST} ${MOD_IDX} WRK) - FILE(APPEND "${MODULES_C}" "&${WRK}_worker,\n") + FILE(APPEND "${WORKERS_C}" "&${WRK}_worker,\n") ENDFOREACH(MOD_IDX RANGE ${WLIST_MAX}) - FILE(APPEND "${MODULES_C}" "NULL\n};\n") -ENDMACRO(_AddModulesForced MLIST WLIST) + FILE(APPEND "${WORKERS_C}" "NULL\n};\n") +ENDMACRO(_AddWorkersForced WLIST) MACRO(AddModules MLIST WLIST) - _AddModulesForced(${MLIST} ${WLIST}) + _AddModulesForced(${MLIST}) + _AddWorkersForced(${WLIST}) #IF(NOT EXISTS "modules.c") # _AddModulesForced(${MLIST} ${WLIST}) #ELSE(NOT EXISTS "modules.c") @@ -63,8 +71,7 @@ ADD_SUBDIRECTORY(libmime) ADD_SUBDIRECTORY(libstat) ADD_SUBDIRECTORY(client) -SET(RSPAMDSRC ${CMAKE_CURRENT_BINARY_DIR}/modules.c - controller.c +SET(RSPAMDSRC controller.c fuzzy_storage.c lua_worker.c main.c @@ -86,11 +93,12 @@ 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}) + ${RSPAMD_STAT} ${RSPAMD_MIME} ${RSPAMD_CRYPTOBOX} + ${CMAKE_CURRENT_BINARY_DIR}/modules.c ${PLUGINSSRC}) TARGET_LINK_LIBRARIES(rspamd-server rspamd-http-parser) TARGET_LINK_LIBRARIES(rspamd-server rspamd-cdb) -ADD_EXECUTABLE(rspamd ${RSPAMDSRC} ${PLUGINSSRC}) +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) |