When CMAKE_SYSTEM_NAME=Wasi, we are not targeting UNIX or WIN32 but Wasi:
In this case, LLVM should recognize that this is a supported platform even though it is not UNIX or WIN32. Unlike Wasm, Wasi has a set ABI that provides some stability. The casing of "Wasi" is used instead of "WASI" to mirror that of the commonly used value of CMAKE_SYSTEM_NAME=Wasm for generic WebAssembly.
You can build libcxx and libcxxabi for Wasi given that you disable:
- threads
- exceptions
- shared linking
This patch makes it possible to avoid lying to LLVM about Wasi being "UNIX" when it isn't. HandleLLVMOptions.cmake is included by libcxxabi any time you set an LLVM_* flag like LLVM_COMPILER_CHECKED, LLVM_PATH, or LLVM_ENABLE_LIBCXX.
I don't know a lot about CMake, but would be better to add a predicate for WASI so that we can change these FUCHSIA OR UNIX conditions into FUCHSIA OR UNIX OR WASI conditions?