Skip to content

Commit d268787

Browse files
compnerdrokhinip
authored andcommitted
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. Signed-off-by: Kim Topley <ktopley@apple.com>
1 parent 07591d5 commit d268787

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ if(ENABLE_SWIFT)
123123
CFLAGS
124124
-fblocks
125125
-fmodule-map-file=${PROJECT_SOURCE_DIR}/dispatch/module.modulemap
126+
$<$<PLATFORM_ID:Windows>:-D_MT>
127+
# TODO(compnerd) handle /MT builds
128+
$<$<PLATFORM_ID:Windows>:-D_DLL>
126129
DEPENDS
127130
module-maps
128131
DispatchStubs
@@ -133,6 +136,8 @@ if(ENABLE_SWIFT)
133136
-lBlocksRuntime
134137
-L $<TARGET_LINKER_FILE_DIR:dispatch>
135138
-ldispatch
139+
$<$<AND:$<PLATFORM_ID:Windows>,$<CONFIG:Debug>>:-lmsvcrtd>
140+
$<$<AND:$<PLATFORM_ID:Windows>,$<NOT:$<CONFIG:Debug>>>:-lmsvcrt>
136141
MODULE_NAME
137142
Dispatch
138143
MODULE_LINK_NAME
File renamed without changes.

0 commit comments

Comments
 (0)