function(yosys_synth)
    set(options "")
    set(onevalueargs NAME CELL_LIBRARY TOP_MODULE DELAY)
    set(multivalueargs FILES ARGUMENTS)
    cmake_parse_arguments(YOSYS_SYNTH "${options}" "${onevalueargs}" "${multivalueargs}" ${ARGN})
    add_custom_command(OUTPUT ${YOSYS_SYNTH_NAME}
                      COMMAND ${YOSYS}
                              -p \"read_verilog ${YOSYS_SYNTH_FILES}\" 
                              -p \"read_liberty -lib ${YOSYS_SYNTH_CELL_LIBRARY}.lib\" 
                              -p \"synth -top ${YOSYS_SYNTH_TOP_MODULE}\" 
                              -p \"flatten\" 
                              -p \"check -assert\" 
                              -p \"dfflibmap -liberty ${YOSYS_SYNTH_CELL_LIBRARY}.lib\" 
                              -p \"abc -constr ${YOSYS_SYNTH_CELL_LIBRARY}.constr -dff -liberty ${YOSYS_SYNTH_CELL_LIBRARY}.lib -markgroups -D ${YOSYS_SYNTH_DELAY}\" 
                              -p \"stat -width\" 
                              -p \"write_verilog ${CMAKE_BINARY_DIR}/${YOSYS_SYNTH_NAME}\"
                              ${YOSYS_SYNTH_ARGUMENTS}
                      DEPENDS ${YOSYS_SYNTH_FILES})
endfunction()
