diff --git a/cmake/zig-toolchain-riscv64.cmake b/cmake/zig-toolchain-riscv64.cmake new file mode 100644 index 0000000..560bff1 --- /dev/null +++ b/cmake/zig-toolchain-riscv64.cmake @@ -0,0 +1,2 @@ +set(ZIG_TARGET "riscv64-freestanding-none") +include(${CMAKE_CURRENT_LIST_DIR}/zig-toolchain.cmake) diff --git a/cmake/zig-toolchain.cmake b/cmake/zig-toolchain.cmake index 2e526c2..1304ae1 100644 --- a/cmake/zig-toolchain.cmake +++ b/cmake/zig-toolchain.cmake @@ -18,8 +18,12 @@ elseif(ZIG_OS STREQUAL "windows") set(CMAKE_SYSTEM_NAME "Windows") elseif(ZIG_OS STREQUAL "macos") set(CMAKE_SYSTEM_NAME "Darwin") +elseif(ZIG_OS STREQUAL "freestanding") + set(CMAKE_SYSTEM_NAME "Generic") else() - message(WARNING "Unknown OS: ${ZIG_OS}") + # NOTE: If this happens, add a new case with one of the following system names: + # https://cmake.org/cmake/help/latest/variable/CMAKE_SYSTEM_NAME.html#system-names-known-to-cmake + message(FATAL_ERROR "Unknown OS: ${ZIG_OS}") endif() set(CMAKE_SYSTEM_VERSION 1)