diff options
author | Peter Wu <peter@lekensteyn.nl> | 2020-01-21 02:53:24 +0000 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2020-01-21 03:16:57 +0000 |
commit | 3af38b800677a463b97588af383caacf09ce31d1 (patch) | |
tree | 2fb02b40d4d31e97cf631b22a2bdbafa2fbc4b99 /cmake | |
parent | d498196712c209fdcbd92f65c0b47ff26fc6c009 (diff) | |
download | rspamd-3af38b800677a463b97588af383caacf09ce31d1.tar.gz rspamd-3af38b800677a463b97588af383caacf09ce31d1.zip |
[Minor] Make ragel-generated files independent of the parent directory
* Use relative paths for `#line` directives to allow reproducible builds
independent of the absolute build directory. For /b/rspamd/src/x.rl
and build dir /b/build, it could result in `../../build/src/x.rl`.
* The `-L` option for `Inhibit writing #line directives` is useless, it
just comments out the line with `/* ... */`, but that means that the
source file is still different.
* Note that ragel only accepts one input file, despite plural `INPUTS`.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindRagel.cmake | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/cmake/FindRagel.cmake b/cmake/FindRagel.cmake index a058b7fb1..f17766ac6 100644 --- a/cmake/FindRagel.cmake +++ b/cmake/FindRagel.cmake @@ -72,9 +72,16 @@ ${RAGEL_version_error}") macro(RAGEL_TARGET Name) CMAKE_PARSE_ARGUMENTS(RAGEL "" "OUTPUT" "INPUTS;DEPENDS;COMPILE_FLAGS" ${ARGN}) + + file(RELATIVE_PATH RAGEL_OUTPUT_RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" + "${RAGEL_OUTPUT}") + file(RELATIVE_PATH RAGEL_INPUTS_RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" + "${RAGEL_INPUTS}") + add_custom_command(OUTPUT ${RAGEL_OUTPUT} COMMAND ${RAGEL_EXECUTABLE} - ARGS ${RAGEL_COMPILE_FLAGS} -o${RAGEL_OUTPUT} ${RAGEL_INPUTS} + ARGS ${RAGEL_COMPILE_FLAGS} + -o${RAGEL_OUTPUT_RELATIVE} ${RAGEL_INPUTS_RELATIVE} DEPENDS ${RAGEL_INPUTS} ${RAGEL_DEPENDS} COMMENT "[RAGEL][${Name}] Compiling state machine with Ragel ${RAGEL_VERSION}" @@ -93,4 +100,4 @@ endif() # use this include when module file is located in build tree include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(RAGEL REQUIRED_VARS RAGEL_EXECUTABLE - VERSION_VAR RAGEL_VERSION)
\ No newline at end of file + VERSION_VAR RAGEL_VERSION) |