[libc++][CMake] Use debug MSVC runtimes when libc++ is built in debug mode
Summary: This patch allows libc++ to be built against the debug MSVC runtimes instead of just the release ones.
Reviewers: rnk, majnemer, compnerd, smeenai
Subscribers: mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D28725
llvm-svn: 292006
diff --git a/libcxx/lib/CMakeLists.txt b/libcxx/lib/CMakeLists.txt
index f83051f..23a17dd 100644
--- a/libcxx/lib/CMakeLists.txt
+++ b/libcxx/lib/CMakeLists.txt
@@ -102,14 +102,21 @@
if (NOT WIN32)
add_flags_if_supported(-fPIC)
endif()
+
add_link_flags_if_supported(-nodefaultlibs)
if (LIBCXX_TARGETING_MSVC)
+ if (LIBCXX_DEBUG_BUILD)
+ set(LIB_SUFFIX "d")
+ else()
+ set(LIB_SUFFIX "")
+ endif()
add_compile_flags(/Zl)
add_link_flags(/nodefaultlib)
- add_library_flags(ucrt) # Universal C runtime
- add_library_flags(vcruntime) # C++ runtime
- add_library_flags(msvcrt) # C runtime startup files
+
+ add_library_flags(ucrt${LIB_SUFFIX}) # Universal C runtime
+ add_library_flags(vcruntime${LIB_SUFFIX}) # C++ runtime
+ add_library_flags(msvcrt${LIB_SUFFIX}) # C runtime startup files
# Required for standards-complaint wide character formatting functions
# (e.g. `printfw`/`scanfw`)
add_library_flags(iso_stdio_wide_specifiers)