Skip to content

Commit c9d5656

Browse files
committed
build: ensure that we link against the correct library
Ensure that we link against the correct VC runtime libraries. Additionally, enable the macros to indicate that we are linking against the VC runtimes dynamically to get proper DLL storage. This fixes memory issues and file descriptor table synchrony.
1 parent a3bff44 commit c9d5656

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ if(ENABLE_SWIFT)
124124
CFLAGS
125125
-fblocks
126126
-fmodule-map-file=${PROJECT_SOURCE_DIR}/dispatch/module.modulemap
127+
$<$<PLATFORM_ID:Windows>:-D_MT>
128+
# TODO(compnerd) handle /MT builds
129+
$<$<PLATFORM_ID:Windows>:-D_DLL>
127130
DEPENDS
128131
module-maps
129132
DispatchStubs
@@ -134,6 +137,8 @@ if(ENABLE_SWIFT)
134137
-lBlocksRuntime
135138
-L $<TARGET_LINKER_FILE_DIR:dispatch>
136139
-ldispatch
140+
$<$<AND:$<PLATFORM_ID:Windows>,$<CONFIG:Debug>>:-lmsvcrtd>
141+
$<$<AND:$<PLATFORM_ID:Windows>,$<NOT:$<CONFIG:Debug>>>:-lmsvcrt>
137142
MODULE_NAME
138143
Dispatch
139144
MODULE_LINK_NAME

0 commit comments

Comments
 (0)