[libcxx-commits] [libcxx] 9b02e8d - [libcxx] Respect CMAKE_MSVC_RUNTIME_LIBRARY wrt whether to use the debug CRT
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Aug 4 05:55:34 PDT 2023
Author: Martin Storsjö
Date: 2023-08-04T15:53:45+03:00
New Revision: 9b02e8d4a0abd60ae1a825e4192fc4ea67ba9049
URL: https://github.com/llvm/llvm-project/commit/9b02e8d4a0abd60ae1a825e4192fc4ea67ba9049
DIFF: https://github.com/llvm/llvm-project/commit/9b02e8d4a0abd60ae1a825e4192fc4ea67ba9049.diff
LOG: [libcxx] Respect CMAKE_MSVC_RUNTIME_LIBRARY wrt whether to use the debug CRT
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.
Differential Revision: https://reviews.llvm.org/D155561
Added:
Modified:
libcxx/CMakeLists.txt
libcxx/test/CMakeLists.txt
Removed:
################################################################################
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 38afb1cb0e7274..49e94d18d8ea89 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -682,7 +682,8 @@ function(cxx_link_system_libraries target)
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 "")
diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt
index 17c8952acbb127..c7036b94dcc596 100644
--- a/libcxx/test/CMakeLists.txt
+++ b/libcxx/test/CMakeLists.txt
@@ -59,7 +59,8 @@ if (MSVC)
set(cxx_lib "libcpmt")
endif()
- 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(dbg_include " -D_DEBUG -include set_windows_crt_report_mode.h")
set(crt_lib "${crt_lib}d")
set(cxx_lib "${cxx_lib}d")
More information about the libcxx-commits
mailing list