LibAtomic fails to safely land after failing to detect

I get cmake/modules/CheckAtomic.cmake:59
Host compiler appears to require libatomic, but cannot find it.

I think this is either a bug in CMake or LLVM’s Linker. I’m using the WASI-SDK from here.

This is while trying to cross-compile LLVM 13 for WASI using the following command line:

cmake ../../../3rdParty/llvm-project/llvm -G "Ninja" -DWASI_SDK_PREFIX=/opt/wasi-sdk --toolchain=/opt/wasi-sdk/share/cmake/wasi-sdk.cmake -DCMAKE_C_FLAGS="--sysroot=/opt/wasi-sdk/share/wasi-sysroot -mno-atomics" -DLLVM_TARGETS_TO_BUILD= -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DLLVM_USE_HOST_TOOLS:BOOL=ON -DCMAKE_HOST_SYSTEM_NAME="Linux" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../../../3rdParty/llvm-wasi/debug -DCMAKE_CROSSCOMPILING_EMULATOR="wasmer" -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON -DLLVM_ENABLE_THREADS=OFF

Edit

Cross-posted to the LLVM Discourse.

Update

CMake is testing for a working libAtomic.a on a single-threaded environment using Clang. Namely target wasm32-wasi. Can someone tell me how to update the detection script to report no functioning libAtomic.a if libAtomic.a is completely absent on the architecture in question? Currently trying to test using Clang isn’t working when it links against a non-existant file.

Edit

This is not a usage problem. I’ll make a new thread in the proper category.