commit 3af38b8: [Minor] Make ragel-generated files independent of the parent directory
Peter Wu
peter at lekensteyn.nl
Tue Jan 21 09:14:15 UTC 2020
Author: Peter Wu
Date: 2020-01-21 02:53:24 +0000
URL: https://github.com/rspamd/rspamd/commit/3af38b800677a463b97588af383caacf09ce31d1
[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`.
---
cmake/FindRagel.cmake | 11 +++++++++--
1 file 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)
More information about the Commits
mailing list