add_executable(bench
    qsort/qsort.c
    ssort/ssort.cc
    queen/queen.c
    sieve/sieve.c
    bf/bf.c
    15pz/15pz.cc
    dinic/dinic.cc
    lzip/lzip.c
    lzip/quicklz.c
    md5/md5.c
    bench.c
    fib/fib.c
)

target_link_libraries(bench am-${ARCH} klib npcgcc)

# -- Extract binary file from ELF
add_custom_command(TARGET bench
    COMMAND ${CMAKE_OBJCOPY} ARGS  -S --set-section-flags .bss=alloc,contents -O binary bench bench.bin)

install(TARGETS bench RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/am-kernels)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bench.bin DESTINATION ${CMAKE_INSTALL_DATADIR}/am-kernels)
