[libcxx-commits] [PATCH] D155561: [libcxx] Respect CMAKE_MSVC_RUNTIME_LIBRARY wrt whether to use the debug CRT
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 18 01:02:56 PDT 2023
mstorsjo created this revision.
mstorsjo added reviewers: jyknight, andrewng, Mordante.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added a reviewer: libc++.
If CMAKE_MSVC_RUNTIME_LIBRARY isn't set, then CMake defaults to
the debug CRT, if CMAKE_BUILD_TYPE is set to Debug. If
CMAKE_MSVC_RUNTIME_LIBRARY is set though, that overrides any
implicit defaults.
Match this in libcxx's own manual linking logic. This allows
decoupling the debug CRT from the CMAKE_BUILD_TYPE and allows users
to configure their builds exactly how they want.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D155561
Files:
libcxx/CMakeLists.txt
libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in
libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in
libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in
Index: libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in
===================================================================
--- libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in
+++ libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in
@@ -13,7 +13,7 @@
crt_lib = 'libcmt'
cxx_lib = 'libcpmt'
-if '@uppercase_CMAKE_BUILD_TYPE@' == 'DEBUG':
+if (runtime_library == '' and '@uppercase_CMAKE_BUILD_TYPE@' == 'DEBUG') or 'Debug' in runtime_library:
dbg_include = ' -D_DEBUG -include set_windows_crt_report_mode.h'
crt_lib += 'd'
cxx_lib += 'd'
Index: libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in
===================================================================
--- libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in
+++ libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in
@@ -14,7 +14,7 @@
crt_lib = 'libcmt'
cxx_lib = 'libcpmt'
-if '@uppercase_CMAKE_BUILD_TYPE@' == 'DEBUG':
+if (runtime_library == '' and '@uppercase_CMAKE_BUILD_TYPE@' == 'DEBUG') or 'Debug' in runtime_library:
dbg_include = ' -D_DEBUG -include set_windows_crt_report_mode.h'
crt_lib += 'd'
cxx_lib += 'd'
Index: libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in
===================================================================
--- libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in
+++ libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in
@@ -13,7 +13,7 @@
crt_lib = 'libcmt'
cxx_lib = 'libcpmt'
-if '@uppercase_CMAKE_BUILD_TYPE@' == 'DEBUG':
+if (runtime_library == '' and '@uppercase_CMAKE_BUILD_TYPE@' == 'DEBUG') or 'Debug' in runtime_library:
dbg_include = ' -D_DEBUG -include set_windows_crt_report_mode.h'
crt_lib += 'd'
cxx_lib += 'd'
Index: libcxx/CMakeLists.txt
===================================================================
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -705,7 +705,8 @@
endif()
if (MSVC)
- if (uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
+ if ((NOT CMAKE_MSVC_RUNTIME_LIBRARY AND uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
+ OR (CMAKE_MSVC_RUNTIME_LIBRARY MATCHES "Debug"))
set(LIB_SUFFIX "d")
else()
set(LIB_SUFFIX "")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155561.541377.patch
Type: text/x-patch
Size: 2229 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230718/51159760/attachment-0001.bin>
More information about the libcxx-commits
mailing list