ClassicOS/x86-baremetal-toolchain.cmake

15 lines
521 B
CMake
Raw Normal View History

2023-10-31 16:21:54 -07:00
# x86-baremetal-toolchain.cmake
# Specify the cross-compiler (If you need one; otherwise, your native GCC should work)
set(CMAKE_ASM_COMPILER nasm)
set(CMAKE_C_COMPILER gcc)
set(CMAKE_CXX_COMPILER g++)
set(CMAKE_C_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
# Add compiler and linker flags for x86 bare metal
set(CMAKE_ASM_NASM_FLAGS "-f elf32")
set(CMAKE_C_FLAGS "-m32 -ffreestanding -nostdlib")
set(CMAKE_CXX_FLAGS "-m32 -ffreestanding -nostdlib")
set(CMAKE_EXE_LINKER_FLAGS "-T${CMAKE_CURRENT_LIST_DIR}/linker.ld -m32")