YexuanXiao wrote: This patch is useful. This is a simple way to get rid of the huge Visual Studio installation. I use the following command line to configure my project with cmake and use libc++ as the standard library on Windows: ```powershell cmake -G Ninja -D "CMAKE_C_COMPILER=D:\Projects\clang\llvm\bin\clang.exe" -D "CMAKE_CXX_COMPILER=D:\Projects\clang\llvm\bin\clang++.exe" -D "CMAKE_C_FLAGS=--target=x86_64-windows-msvc --sysroot=D:\Projects\windows-msvc-sysroot -fuse-ld=lld" -D "CMAKE_CXX_FLAGS=--target=x86_64-windows-msvc --sysroot=D:\Projects\windows-msvc-sysroot -fuse-ld=lld -stdlib=libc++" .. ``` By changing -stdlib=libc++ to -stdlib=stl, I can use stl as the C++ standard library.
Due to cmake [incorrectly](https://gitlab.kitware.com/cmake/cmake/-/issues/20705) using msvc-style lld-link instead of lld when using gnu-sysroot, manual compilation is currently the only way to use gnu-sysroot: ```powershell clang++ --target=x86_64-windows-gnu --sysroot=D:\Projects\clang\x86_64-windows-gnu -rtlib=compiler-rt --unwindlib=libunwind -fuse-ld=lld -stdlib=libc++ -lc++abi -lunwind -std=c++23 examples.cpp ``` Overall, I believe this patch is effective, although windows-msvc-sysroot is a private repository, it doesn't have any conceptual differences from other sysroots. Perhaps the author should create a tutorial on how to build this system root. https://github.com/llvm/llvm-project/pull/96417 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits