diff --git a/cmake/Modules/GenerateYFromYm.cmake b/cmake/Modules/GenerateYFromYm.cmake index 1b8b65e4a7..5f2625bc23 100644 --- a/cmake/Modules/GenerateYFromYm.cmake +++ b/cmake/Modules/GenerateYFromYm.cmake @@ -41,10 +41,16 @@ endfunction() # This function is used by add_module function(module_generate_y_from_ym FileWoExtSrc FileWoExtDst) - if (${ARGC} EQUAL 2) + if (${ARGC} EQUAL 2 OR ${ARGC} EQUAL 3) + set(DEPS ${PROJECT_SOURCE_DIR}/lib/cfg-grammar.y) + + if (${ARGC} EQUAL 3) + set(DEPS ${DEPS} ${ARGV2}) + endif() + add_custom_command (OUTPUT ${FileWoExtDst}.y COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/lib/merge-grammar.py ${FileWoExtSrc}.ym > ${FileWoExtDst}.y - DEPENDS ${PROJECT_SOURCE_DIR}/lib/cfg-grammar.y + DEPENDS ${DEPS} ${FileWoExtSrc}.ym) else() message(SEND_ERROR "Wrong usage of module_generate_y_from_ym() function") diff --git a/cmake/add_module.cmake b/cmake/add_module.cmake index 63e464dc31..062ab523df 100644 --- a/cmake/add_module.cmake +++ b/cmake/add_module.cmake @@ -26,10 +26,10 @@ include(CMakeParseArguments) function (add_module) - cmake_parse_arguments(ADD_MODULE "" "TARGET" "GRAMMAR;SOURCES;DEPENDS;INCLUDES;LIBRARY_TYPE;COMPILE_OPTIONS" ${ARGN}) + cmake_parse_arguments(ADD_MODULE "" "TARGET" "GRAMMAR;GRAMMAR_DEPENDS;SOURCES;DEPENDS;INCLUDES;LIBRARY_TYPE;COMPILE_OPTIONS" ${ARGN}) if (ADD_MODULE_GRAMMAR) - module_generate_y_from_ym(${CMAKE_CURRENT_SOURCE_DIR}/${ADD_MODULE_GRAMMAR} ${CMAKE_CURRENT_BINARY_DIR}/${ADD_MODULE_GRAMMAR}) + module_generate_y_from_ym(${CMAKE_CURRENT_SOURCE_DIR}/${ADD_MODULE_GRAMMAR} ${CMAKE_CURRENT_BINARY_DIR}/${ADD_MODULE_GRAMMAR} ${ADD_MODULE_GRAMMAR_DEPENDS}) bison_target(${ADD_MODULE_TARGET}Grammar} ${CMAKE_CURRENT_BINARY_DIR}/${ADD_MODULE_GRAMMAR}.y ${CMAKE_CURRENT_BINARY_DIR}/${ADD_MODULE_GRAMMAR}.c