From: Peter Wu Date: Tue, 21 Jan 2020 02:53:24 +0000 (+0000) Subject: [Minor] Make ragel-generated files independent of the parent directory X-Git-Tag: 2.3~71^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3af38b800677a463b97588af383caacf09ce31d1;p=rspamd.git [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`. --- 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)