kernel/kernel/CMakeLists.txt

24 lines
767 B
CMake

set(C 99)
set(CMAKE_NASM_COMPILE_OBJECT "nasm <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>")
add_executable(kernel)
add_library (kernel_asm OBJECT)
target_include_directories(kernel PRIVATE inc)
file(GLOB_RECURSE kernel_src_c "**/*.c")
file(GLOB_RECURSE kernel_inc "**/*.h")
file(GLOB_RECURSE kernel_src_asm "**/*.asm")
target_compile_options(kernel PRIVATE -g -fno-stack-protector -fno-stack-check -mno-red-zone -ffreestanding -m64 -march=x86-64 -mabi=sysv)
target_link_options(kernel PRIVATE -nostdlib -static -T "${CMAKE_CURRENT_LIST_DIR}/kernel.ld")
enable_language(ASM_NASM)
set(CAN_USE_ASSEMBLER TRUE)
target_sources(kernel_asm PRIVATE ${kernel_src_asm})
target_sources(kernel PRIVATE ${kernel_src_c} ${kernel_inc} $<TARGET_OBJECTS:kernel_asm>)