Skip to content

Commit 8488657

Browse files
authored
Merge pull request #1938 from compnerd/all-the-libraries
build: link in dependencies on Windows
2 parents 0bdef0e + f4dcc0b commit 8488657

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

CMakeLists.txt

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,30 @@ endif()
9999

100100
if(CMAKE_SYSTEM_NAME STREQUAL Android OR CMAKE_SYSTEM_NAME STREQUAL Linux)
101101
set(deployment_target -DDEPLOYMENT_TARGET_LINUX)
102-
set(Foundation_rpath_flags -Xlinker;-rpath;-Xlinker;"\\\$\$ORIGIN")
102+
set(Foundation_RPATH -Xlinker;-rpath;-Xlinker;"\\\$\$ORIGIN")
103103
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
104104
set(deployment_target -DDEPLOYMENT_TARGET_MACOSX)
105105
elseif(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
106106
set(deployment_target -DDEPLOYMENT_TARGET_FREEBSD)
107-
set(Foundation_rpath_flags -Xlinker;-rpath;-Xlinker;"\\\$\$ORIGIN")
107+
set(Foundation_RPATH -Xlinker;-rpath;-Xlinker;"\\\$\$ORIGIN")
108108
elseif(CMAKE_SYSTEM_NAME STREQUAL Windows)
109109
set(deployment_target -DDEPLOYMENT_TARGET_WINDOWS)
110+
# FIXME(compnerd) these are not all CoreFoundation dependencies, some of them
111+
# are Foundation's. We should split them up accordingly.
112+
set(CoreFoundation_INTERFACE_LIBRARIES
113+
-lAdvAPI32
114+
-lDbgHelp
115+
-lShell32
116+
-lOle32
117+
-lRpcRT4
118+
-lSecur32
119+
-lShLwApi
120+
-lUser32
121+
-lWS2_32
122+
-liphlpapi
123+
-lpathcch
124+
-lucrt
125+
-lshell32)
110126
endif()
111127

112128
add_swift_library(Foundation
@@ -295,7 +311,8 @@ add_swift_library(Foundation
295311
${libdispatch_ldflags}
296312
-L${CMAKE_CURRENT_BINARY_DIR}
297313
-luuid
298-
${Foundation_rpath_flags}
314+
${Foundation_RPATH}
315+
${CoreFoundation_INTERFACE_LIBRARIES}
299316
SWIFT_FLAGS
300317
-DDEPLOYMENT_RUNTIME_SWIFT
301318
${deployment_enable_libdispatch}

0 commit comments

Comments
 (0)