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}")
-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})