]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Improve ragel support in cmake
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 20 Jan 2021 12:54:45 +0000 (12:54 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 22 Jan 2021 15:58:05 +0000 (15:58 +0000)
cmake/FindRagel.cmake

index f17766ac6d61ebbc164a03cd6eda82e7b1097317..d02a00bea7b2af3f5da28678d1220885abc09bf0 100644 (file)
@@ -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})