commit 19ec441: [Minor] Improve ragel support in cmake

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Jan 22 16:00:24 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-01-20 12:54:45 +0000
URL: https://github.com/rspamd/rspamd/commit/19ec44180cef856f21d39db54364d162c972dc05

[Minor] Improve ragel support in cmake

---
 cmake/FindRagel.cmake | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/cmake/FindRagel.cmake b/cmake/FindRagel.cmake
index f17766ac6..d02a00bea 100644
--- a/cmake/FindRagel.cmake
+++ b/cmake/FindRagel.cmake
@@ -73,7 +73,7 @@ ${RAGEL_version_error}")
     CMAKE_PARSE_ARGUMENTS(RAGEL "" "OUTPUT"
 		"INPUTS;DEPENDS;COMPILE_FLAGS" ${ARGN})
 
-    file(RELATIVE_PATH RAGEL_OUTPUT_RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
+    file(RELATIVE_PATH RAGEL_OUTPUT_RELATIVE "${CMAKE_CURRENT_BINARY_DIR}"
          "${RAGEL_OUTPUT}")
     file(RELATIVE_PATH RAGEL_INPUTS_RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
          "${RAGEL_INPUTS}")
@@ -84,8 +84,11 @@ ${RAGEL_version_error}")
               -o${RAGEL_OUTPUT_RELATIVE} ${RAGEL_INPUTS_RELATIVE}
       DEPENDS ${RAGEL_INPUTS} ${RAGEL_DEPENDS}
       COMMENT
-          "[RAGEL][${Name}] Compiling state machine with Ragel ${RAGEL_VERSION}"
+          "[RAGEL][${Name}] Compiling state machine with Ragel ${RAGEL_VERSION} -> ${RAGEL_OUTPUT}"
       WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+    get_filename_component(src_target ${RAGEL_INPUTS} NAME_WE)
+    add_custom_target(ragel_${src_target} DEPENDS ${RAGEL_OUTPUT})
+    set_source_files_properties(${RAGEL_OUTPUT} PROPERTIES GENERATED TRUE)
 
     set(RAGEL_${Name}_DEFINED       TRUE)
     set(RAGEL_${Name}_OUTPUTS       ${RAGEL_OUTPUT})


More information about the Commits mailing list