am-kernels/kernels/hello/CMakeLists.txt

14 lines
655 B
CMake

add_executable(hello
hello.c
)
target_include_directories(hello PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../include)
target_link_libraries(hello PRIVATE am-${ARCH} klib npcgcc)
target_compile_options(hello PRIVATE -nostdlib -nodefaultlibs)
target_link_options(hello PRIVATE -nostdlib -nodefaultlibs)
# -- Extract binary file from ELF
add_custom_command(TARGET hello
COMMAND ${CMAKE_OBJCOPY} ARGS -S --set-section-flags .bss=alloc,contents -O binary hello hello.bin)
install(TARGETS hello RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/am-kernels)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/hello.bin DESTINATION ${CMAKE_INSTALL_DATADIR}/am-kernels)