[PATCH] D155431: [CMake] Clean up old code for handling MSVC runtime setting the old way

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 28 06:35:27 PDT 2023


mstorsjo added a comment.

In D155431#4651678 <https://reviews.llvm.org/D155431#4651678>, @yurybura wrote:

>> Are you saying that this gets added automatically by CMake in this variable, or that it is set manually by your build configuration? I don't think it's added automatically by CMake.
>
> I'm saying that VCPKG adds these compiler flags.

And I'm saying that it's redundant.

>> The point is that by switching `CMAKE_MSVC_RUNTIME_LIBRARY` to the right choice, debug/non-debug, the define `_DEBUG` gets added automatically by the compiler if building in a debug mode. You shouldn't be adding that manually.
>
> As I understand `_DEBUG` is not added by default. How to add it for Debug config for the whole LLVM/Clang build but exclude adding it to `compiler-rt` or `libcxx`?

Why do you feel that you need to add `_DEBUG` at all?

If you set `CMAKE_MSVC_RUNTIME_LIBRARY` to a debug CRT, this define gets added automatically by the compiler. (And conversely, if something further down the build chain chooses to override `CMAKE_MSVC_RUNTIME_LIBRARY`, there's no conflicting `_DEBUG` define either.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155431/new/

https://reviews.llvm.org/D155431



More information about the llvm-commits mailing list