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 /FindRagel.cmake | |
parent | 4effc0640c5a8d40b347c446b6b4c2ac4e936bb2 (diff) | |
download | rspamd-3c967aea98e39d0834a9588e84b465116a764cb2.tar.gz rspamd-3c967aea98e39d0834a9588e84b465116a764cb2.zip |
[Feature] Improve ragel build target
Diffstat (limited to 'FindRagel.cmake')
-rw-r--r-- | FindRagel.cmake | 33 |
1 files changed, 10 insertions, 23 deletions
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() |