MSVC /MD(d) is MultiThreaded(Debug)**DLL** (#303)

See  https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html
for details.
This commit is contained in:
Degen's Regens
2025-08-22 23:40:34 +02:00
committed by GitHub
parent 581fc7f17d
commit 71856d9e82

View File

@@ -44,9 +44,9 @@ macro(msvc_posix target)
endif() endif()
endmacro() endmacro()
set(LIBDWARF_CRT "MD" CACHE STRING "Either MT or MD, specifies whether to use the static or dynamic MSVCRT.")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(LIBDWARF_CRT "MD" CACHE STRING "Either MT or MD, specifies whether to use the static or dynamic MSVCRT.")
# Use CMAKE_MSVC_RUNTIME in versions 3.15 and up # Use CMAKE_MSVC_RUNTIME in versions 3.15 and up
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15") if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15")
cmake_policy(SET CMP0091 NEW) cmake_policy(SET CMP0091 NEW)
@@ -55,7 +55,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
elseif(LIBDWARF_CRT STREQUAL "MD") elseif(LIBDWARF_CRT STREQUAL "MD")
message(STATUS "Using MD runtime by CMAKE_MSVC_RUNTIME_LIBRARY") message(STATUS "Using MD runtime by CMAKE_MSVC_RUNTIME_LIBRARY")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
else() else()
message(FATAL_ERROR "LIBDWARF_CRT must be MT or MD") message(FATAL_ERROR "LIBDWARF_CRT must be MT or MD")
endif() endif()