[llvm-dev] How to Switch to Static Runtime and Enable C++ Exceptions?

Alexandre Ganea via llvm-dev llvm-dev at lists.llvm.org
Mon Oct 28 13:36:02 PDT 2019


Yes you’re right, -DLLVM_USE_CRT_RELEASE=MT works indeed! Although the “Visual Studio” cmake generators are multi-config, so you end up with -DCMAKE_BUILD_TYPE=Release  being ignored, which means that if you want to make things right, you would need to also set the other –DLLVM_USE_CRT_XXX values as well, to avoid surprises when switching targets inside VS. For those multi-config generators, reintroducing -DLLVM_USE_CRT would be nice, maybe.

De : Reid Kleckner <rnk at google.com>
Envoyé : October 28, 2019 4:13 PM
À : Alexandre Ganea <alexandre.ganea at ubisoft.com>
Cc : Osman Zakir <osmanzakir90 at hotmail.com>; llvm-dev <llvm-dev at lists.llvm.org>
Objet : Re: [llvm-dev] How to Switch to Static Runtime and Enable C++ Exceptions?

On Mon, Oct 28, 2019 at 5:11 AM Alexandre Ganea via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote:
You can’t enable the static CRT through the command-line. You would need to apply this patch: https://reviews.llvm.org/D55056
(although it doesn’t work with lldb)

Are you sure? I would expect `cmake -DLLVM_USE_CRT_RELEASE=MT` to use the static CRT.

I think Zach is correct, Osman can use -DLLVM_ENABLE_EH=ON, and it will enable exceptions.

You're still getting a warning from the benchmark library because LLVM's cmake forcibly disables benchmark library exceptions here:
https://github.com/llvm/llvm-project/blob/2724d9e/llvm/CMakeLists.txt#L1094
That's probably a bug, it should probably be dependent on LLVM_ENABLE_EH.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191028/ad061eab/attachment.html>


More information about the llvm-dev mailing list