Skip to content

Commit f5a327c

Browse files
marler8997alexrp
authored andcommitted
windows: msvc: avoid linking to non-redistributable ucrt
1 parent 36499c2 commit f5a327c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,16 @@ if(ZIG_STATIC_ZSTD)
159159
list(APPEND LLVM_LIBRARIES "${ZSTD}")
160160
endif()
161161

162+
if (MSVC)
163+
if(NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
164+
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
165+
# avoid linking to the debug versions of ucrt by default
166+
# as they are not redistributable.
167+
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
168+
endif()
169+
endif()
170+
endif ()
171+
162172
if(ZIG_STATIC_CURSES)
163173
list(REMOVE_ITEM LLVM_LIBRARIES "-lcurses")
164174
find_library(CURSES NAMES libcurses.a libncurses.a NAMES_PER_DIR

0 commit comments

Comments
 (0)