<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62739>62739</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
LLVM_USE_CRT_RELEASE/DEBUG seems to have been broken with the update to require CMake 3.20
</td>
</tr>
<tr>
<th>Labels</th>
<td>
cmake
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dschuff
</td>
</tr>
</table>
<pre>
LLVM has the CMake flag `LLVM_USE_CRT_RELEASE` (and a debug equivalent) that can add e.g. the `/MT` compiler flag to select the static C runtime. With the update to require a newer version of CMake, this seems to have stopped working.
I'm using Cmake 3.21 with clang-cl and using `-DLLVM_USE_CRT_RELEASE=MT`, and found that after the update, clang was getting passed the `/MT` flag but then after that the `-MD` flag was being added by CMake. This seems to be because of https://cmake.org/cmake/help/latest/policy/CMP0091.html, a new feature that does a similar runtime selection at the CMake level. I found that adding `-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded` made it start working again.
So, probably `LLVM_USE_CRT_{RELEASE,DEBUG}` needs to be updated somehow to work with the new policy, or perhaps it can just be removed in favor of the CMake version.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxslEFv6jgUhX-N2Vw1chwSYJEFDTCqpoxGlL7RrNBNfEn86sQZ2wH134-cQDudvg0gcnPs851jo3Oq7ohylj6ydDPDwTfG5tJVzXA-z0oj3_Pn5x97aNCBbwiKPb4RnDXWwDIeHp1eX7an4nA8HbbP2_XLlmUcmFhiJwFBUjnUQP8M6oKaOs_ECnyDHirsAKUEiupoFGYZZ2K3P4bXK9P2SpOd1vEGHGmq_DjnPHpVQQF26LxqKYK_lG_GR0Mv0VOYt2FFS4DQ0ZUsXMg6ZTow58kAEwX4RjlwRK0LbzR4Cdqm70nC1dg31dUR4xvG109MLFoYnOpqKNpgP4lEDNewbKWxqx8qDcHuNMIy_rD5JZhkM9oLi4fxsxk6OdHAsyf7Hw9hZJSGKzqoyfug3KNzJL_RGiGVw4in-5BCfx982G8-xoJcSUEMpSQJ5fsEJILjFxwlQUkVDo4Cs8b73rFkzcSOiV0VGETG1vffTOwa0j0TO42enGdi1xutqncmdsX-T85XcdT4Vo_GQyJwJvSDpWmb0pADBKdapdHec71lHlK7WZmqp-lCOoKnL_ik_CBf7Ne_b0_7lx_F6fD6x_Fpvz09Pz0e1oe_A_9Be3VsLKEkGaC0KAmUD62y_p47YI2qu6U_fb6YsPnemhJL_f6t-mzxeA9ZFJvt4-tvbDFC74jkHegUrQRnWmrMNfwbFpyKFAwGMndwBRgLPdkGexc2GM7Lz8H5IGSpNReSoDo448XYENEnoFvXo5nME7lKVjijPM6Wc5Gmi5jPmlwsxVnMac4XyTxLeZnGPJXzNF0tEpFmcTxTueAi4Wmcxdl8mfBouYoXVUrlco6lTLOUzTm1qHSk9aUNTZgp5wbKM7FIVjONJWk33ihC3AoiwuVi8zD_UA61Y3OulfPuU8Erryn_5bkRuxHp_w5rSdRBac0bdZ8Iv18BE5QkEnw2WJ1_rXKtfDOUUWXaUF59uX899Nb8pCo0eXTmmNiN5v4NAAD__6mAsXY">