Skip to content

Commit d1eb3a5

Browse files
authored
Merge pull request swiftlang#20766 from compnerd/importing-fat
build; correct swift fat library linking on Windows
2 parents 4dc26ba + d8bce85 commit d1eb3a5

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,11 +2138,19 @@ function(_add_swift_executable_single name)
21382138
# Find the names of dependency library targets.
21392139
#
21402140
# We don't add the ${ARCH} to the target suffix because we want to link
2141-
# against fat libraries.
2142-
_list_add_string_suffix(
2143-
"${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES}"
2144-
"-${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}"
2145-
SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES_TARGETS)
2141+
# against fat libraries. This only works for the Darwin targets as MachO is
2142+
# the only format with the fat libraries.
2143+
if(${SWIFTEXE_SINGLE_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
2144+
_list_add_string_suffix(
2145+
"${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES}"
2146+
"-${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}"
2147+
SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES_TARGETS)
2148+
else()
2149+
_list_add_string_suffix(
2150+
"${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES}"
2151+
"-${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}-${SWIFTEXE_SINGLE_ARCHITECTURE}"
2152+
SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES_TARGETS)
2153+
endif()
21462154

21472155
handle_swift_sources(
21482156
dependency_target

0 commit comments

Comments
 (0)