Skip to content

Commit b8888e5

Browse files
authored
Merge pull request swiftlang#1831 from compnerd/flags
Improve flags handling for Windows build
2 parents 72a8dab + 5a12714 commit b8888e5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,12 @@ endif()
102102

103103
if(CMAKE_SYSTEM_NAME STREQUAL Android OR CMAKE_SYSTEM_NAME STREQUAL Linux)
104104
set(deployment_target -DDEPLOYMENT_TARGET_LINUX)
105+
set(Foundation_rpath_flags -Xlinker;-rpath;-Xlinker;"\\\$\$ORIGIN")
105106
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
106107
set(deployment_target -DDEPLOYMENT_TARGET_MACOSX)
107108
elseif(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
108109
set(deployment_target -DDEPLOYMENT_TARGET_FREEBSD)
110+
set(Foundation_rpath_flags -Xlinker;-rpath;-Xlinker;"\\\$\$ORIGIN")
109111
elseif(CMAKE_SYSTEM_NAME STREQUAL Windows)
110112
set(deployment_target -DDEPLOYMENT_TARGET_WINDOWS)
111113
endif()
@@ -278,6 +280,7 @@ add_swift_library(Foundation
278280
${deployment_target}
279281
${deployment_enable_libdispatch}
280282
-F${install_dir}/System/Library/Frameworks
283+
-D_DLL
281284
LINK_FLAGS
282285
-L${install_dir}/usr/lib
283286
-lCoreFoundation
@@ -287,7 +290,7 @@ add_swift_library(Foundation
287290
${libdispatch_ldflags}
288291
-L${CMAKE_CURRENT_BINARY_DIR}
289292
-luuid
290-
-Xlinker;-rpath;-Xlinker;"\\\$\$ORIGIN"
293+
${Foundation_rpath_flags}
291294
SWIFT_FLAGS
292295
-DDEPLOYMENT_RUNTIME_SWIFT
293296
${deployment_enable_libdispatch}

0 commit comments

Comments
 (0)