1set(CMAKE_SYSTEM_NAME Generic)
2
3set(CMAKE_C_COMPILER clang)
4set(CMAKE_CXX_COMPILER clang++)
5set(CMAKE_ASM_COMPILER clang)
6
7set(CMAKE_AR xtensa-esp32-elf-ar)
8set(CMAKE_RANLIB xtensa-esp32-elf-gcc-ranlib)
9set(CMAKE_OBJDUMP xtensa-esp32-elf-objdump)
10
11# -freestanding is a hack to force Clang to use its own stdatomic.h,
12# without falling back to the (incompatible) GCC stdatomic.h
13# https://github.com/espressif/llvm-project/blob/d9341b81/clang/lib/Headers/stdatomic.h#L13-L18
14set(CMAKE_C_FLAGS "--target=xtensa -mcpu=esp32 -ffreestanding" CACHE STRING "C Compiler Base Flags")
15set(CMAKE_CXX_FLAGS "--target=xtensa -mcpu=esp32 -ffreestanding" CACHE STRING "C++ Compiler Base Flags")
16set(CMAKE_ASM_FLAGS "--target=xtensa -mcpu=esp32" CACHE STRING "Assembler Base Flags")
17