Building clang+llvm using cmake with Visual Studio generator - how make libclang_rt-builtins use static runtime?

Hi,

I am building LLVM+clang 15.0.7 from source using cmake on Windows with generator set to Visual Studio 16 2019.

The libclang_rt-builtins library ends up using DLL runtime, which is undesired for the application. I set LLVM_USE_CRT_DEBUG=MT and LLVM_USE_CRT_RELEASE=MT but it doesn’t work - the library is still using DLL runtime libraries.

I then tried using the Ninja generator and then it did work.

Is this a known issue, and is there a fix in a later version of llvm-project, or some other known way to fix this?

Unfortunately I need to continue using a Visual Studio generator because we have fairly weak CPU power on our build systems, but a powerful IncrediBuild network, and Visual Studio projects are compatible with that, so the build is magnitudes faster when using a Visual Studio generator.

I have tried various versions of cmake - an older and the current version of the official one, and the one included with the current version of Visual Studio 2019, but no change.

Background: It’s a project which includes a distribution of clang+llvm for Windows.
Currently doing a major version leap from 7.0 to 15.0.7.
For 7.0, we used generator name “Visual Studio 15 2017 Win64”.

Thanks.
John