diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index fa5fff1d6..0a4924d93 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,26 +55,38 @@ MACRO(_AddModulesForced MLIST WLIST) STRING(RANDOM LENGTH 8 _MODULES_ID) SET(MODULES_ID ${_MODULES_ID} CACHE INTERNAL "Modules ID" FORCE) FILE(WRITE "src/modules.c" "/* ${MODULES_ID} */\n#include \"config.h\"\n") - FOREACH(MOD IN LISTS ${MLIST}) + + # 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) FILE(APPEND "src/modules.c" "extern module_t ${MOD}_module;\n") - ENDFOREACH(MOD IN LISTS ${MLIST}) + ENDFOREACH(MOD_IDX RANGE ${MLIST_MAX}) FILE(APPEND "src/modules.c" "\n\nmodule_t *modules[] = {\n") - FOREACH(MOD IN LISTS ${MLIST}) + FOREACH(MOD_IDX RANGE ${MLIST_MAX}) + LIST(GET ${MLIST} ${MOD_IDX} MOD) FILE(APPEND "src/modules.c" "&${MOD}_module,\n") - ENDFOREACH(MOD IN LISTS ${MLIST}) + ENDFOREACH(MOD_IDX RANGE ${MLIST_MAX}) + FILE(APPEND "src/modules.c" "NULL\n};\n") - FOREACH(WRK IN LISTS ${WLIST}) + FOREACH(MOD_IDX RANGE ${WLIST_MAX}) + LIST(GET ${WLIST} ${MOD_IDX} WRK) FILE(APPEND "src/modules.c" "extern worker_t ${WRK}_worker;\n") - ENDFOREACH(WRK IN LISTS ${WLIST}) + ENDFOREACH(MOD_IDX RANGE ${WLIST_MAX}) FILE(APPEND "src/modules.c" "\n\nworker_t *workers[] = {\n") - FOREACH(WRK IN LISTS ${WLIST}) + FOREACH(MOD_IDX RANGE ${WLIST_MAX}) + LIST(GET ${WLIST} ${MOD_IDX} WRK) FILE(APPEND "src/modules.c" "&${WRK}_worker,\n") - ENDFOREACH(WRK IN LISTS ${WLIST}) + ENDFOREACH(MOD_IDX RANGE ${WLIST_MAX}) FILE(APPEND "src/modules.c" "NULL\n};\n") ENDMACRO(_AddModulesForced MLIST WLIST) @@ -814,6 +826,7 @@ CHECK_SYMBOL_EXISTS(posix_fallocate fcntl.h HAVE_POSIX_FALLOCATE) CHECK_SYMBOL_EXISTS(fallocate fcntl.h HAVE_FALLOCATE) CHECK_SYMBOL_EXISTS(fdatasync unistd.h HAVE_FDATASYNC) CHECK_SYMBOL_EXISTS(_SC_NPROCESSORS_ONLN unistd.h HAVE_SC_NPROCESSORS_ONLN) +CHECK_SYMBOL_EXISTS(setbit sys/param.h PARAM_H_HAS_BITSET) IF(HAVE_SIGINFO_H) CHECK_SYMBOL_EXISTS(SA_SIGINFO "signal.h;siginfo.h" HAVE_SA_SIGINFO) ELSE(HAVE_SIGINFO_H) |