diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-06-14 20:36:50 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-06-14 20:36:50 +0100 |
commit | 3c967aea98e39d0834a9588e84b465116a764cb2 (patch) | |
tree | 2c4a8628cfcf93e666d69bb7045fe990213729dc | |
parent | 4effc0640c5a8d40b347c446b6b4c2ac4e936bb2 (diff) | |
download | rspamd-3c967aea98e39d0834a9588e84b465116a764cb2.tar.gz rspamd-3c967aea98e39d0834a9588e84b465116a764cb2.zip |
[Feature] Improve ragel build target
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | FindRagel.cmake | 33 | ||||
-rw-r--r-- | src/CMakeLists.txt | 15 |
3 files changed, 24 insertions, 30 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ebef8a1ce..84a3f5005 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -729,11 +729,11 @@ CHECK_C_COMPILER_FLAG(-Wunused-variable SUPPORT_WUNUSED_VAR) CHECK_C_COMPILER_FLAG(-Wno-pointer-sign SUPPORT_WPOINTER_SIGN) CHECK_C_COMPILER_FLAG(-Wstrict-prototypes SUPPORT_WSTRICT_PROTOTYPES) CHECK_C_COMPILER_FLAG(-pedantic SUPPORT_PEDANTIC_FLAG) -CHECK_C_COMPILER_FLAG(-pedantic SUPPORT_PEDANTIC_FLAG) +CHECK_C_COMPILER_FLAG(-Wno-unused-const-variable SUPPORT_WNO_UNUSED_CONST) # GCC 6 specific CHECK_C_COMPILER_FLAG(-Wnull-dereference SUPPORT_WNULL_DEREFERENCE) CHECK_C_COMPILER_FLAG(-Wduplicated-cond SUPPORT_WDUPLICATED_COND) -CHECK_C_COMPILER_FLAG(-Wno-unused-const-variable SUPPORT_WNO_UNUSED_CONST) + IF(NOT "${CMAKE_C_COMPILER_ID}" MATCHES SunPro) CHECK_C_COMPILER_FLAG("-std=c11" SUPPORT_STD11_FLAG) CHECK_C_COMPILER_FLAG("-std=c99" SUPPORT_STD99_FLAG) @@ -775,7 +775,7 @@ IF(SUPPORT_WLOGICAL_OP) SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wlogical-op") ENDIF() IF(SUPPORT_WNO_UNUSED_CONST) - SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wunused-const-variable") + SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wno-unused-const-variable") ENDIF() IF(SUPPORT_STD11_FLAG) SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -std=c11") diff --git a/FindRagel.cmake b/FindRagel.cmake index 7b4534a80..b6f7fc2e1 100644 --- a/FindRagel.cmake +++ b/FindRagel.cmake @@ -7,8 +7,8 @@ # # If ragel is found, the module defines the macros: # -# RAGEL_TARGET(<Name> <RagelInp> <CodeOutput> -# [COMPILE_FLAGS <string>]) +# RAGEL_TARGET(<Name> INPUTS <inputs> OUTPUT <output> +# [COMPILE_FLAGS <string>] [DEPENDS <depends>]) # # which will create a custom rule to generate a state machine. <RagelInp> is # the path to a Ragel file. <CodeOutput> is the name of the source file @@ -69,33 +69,20 @@ ${RAGEL_version_error}") # RAGEL_TARGET (public macro) #============================================================ # - macro(RAGEL_TARGET Name Input Output) - set(RAGEL_TARGET_usage - "RAGEL_TARGET(<Name> <Input> <Output> [COMPILE_FLAGS <string>]") - if(${ARGC} GREATER 3) - if(${ARGC} EQUAL 5) - if("${ARGV3}" STREQUAL "COMPILE_FLAGS") - set(RAGEL_EXECUTABLE_opts "${ARGV4}") - separate_arguments(RAGEL_EXECUTABLE_opts) - else() - message(SEND_ERROR ${RAGEL_TARGET_usage}) - endif() - else() - message(SEND_ERROR ${RAGEL_TARGET_usage}) - endif() - endif() - - add_custom_command(OUTPUT ${Output} + macro(RAGEL_TARGET Name) + CMAKE_PARSE_ARGUMENTS(RAGEL "" "OUTPUT" + "INPUTS;DEPENDS;COMPILE_FLAGS" ${ARGN}) + add_custom_command(OUTPUT ${RAGEL_OUTPUT} COMMAND ${RAGEL_EXECUTABLE} - ARGS ${RAGEL_EXECUTABLE_opts} -o${Output} ${Input} - DEPENDS ${Input} + ARGS ${RAGEL_EXECUTABLE_opts} -o${RAGEL_OUTPUT} ${RAGEL_INPUTS} + DEPENDS ${RAGEL_INPUTS} ${RAGEL_DEPENDS} COMMENT "[RAGEL][${Name}] Compiling state machine with Ragel ${RAGEL_VERSION}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) set(RAGEL_${Name}_DEFINED TRUE) - set(RAGEL_${Name}_OUTPUTS ${Output}) - set(RAGEL_${Name}_INPUT ${Input}) + set(RAGEL_${Name}_OUTPUTS ${RAGEL_OUTPUT}) + set(RAGEL_${Name}_INPUT ${RAGEL_INPUTS}) set(RAGEL_${Name}_COMPILE_FLAGS ${RAGEL_EXECUTABLE_opts}) endmacro() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c9f99a7a5..d4765ce79 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -102,12 +102,19 @@ ENDIF() AddModules(MODULES_LIST WORKERS_LIST) LIST(LENGTH PLUGINSSRC RSPAMD_MODULES_NUM) +SET(RAGEL_DEPENDS "${CMAKE_SOURCE_DIR}/src/ragel/smtp_address.rl" + "${CMAKE_SOURCE_DIR}/src/ragel/smtp_date.rl" + "${CMAKE_SOURCE_DIR}/src/ragel/smtp_ip.rl" + "${CMAKE_SOURCE_DIR}/src/ragel/smtp_whitespace.rl" + "${CMAKE_SOURCE_DIR}/src/ragel/smtp_received.rl") RAGEL_TARGET(ragel_smtp_addr - ragel/smtp_addr_parser.rl - ${CMAKE_CURRENT_BINARY_DIR}/smtp_addr_parser.rl.c) + INPUTS ragel/smtp_addr_parser.rl + DEPENDS ${RAGEL_DEPENDS} + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/smtp_addr_parser.rl.c) RAGEL_TARGET(ragel_smtp_received - ragel/smtp_received_parser.rl - ${CMAKE_CURRENT_BINARY_DIR}/smtp_received_parser.rl.c) + INPUTS ragel/smtp_received_parser.rl + DEPENDS ${RAGEL_DEPENDS} + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/smtp_received_parser.rl.c) ######################### LINK SECTION ############################### ADD_LIBRARY(rspamd-server STATIC ${RSPAMD_CRYPTOBOX} ${RSPAMD_UTIL} ${RSPAMD_LUA} ${RSPAMD_SERVER} |