Skip to content

Commit 5a30b27

Browse files
committed
build; correct swift fat library linking on Windows
Windows does not link against the library but the import library. When building the target specific bits, we unfortunately do not use the cmake build infrastructure properly. This results in us trying to link against libraries which do not exist. Redirect the link to the right files. This allows us to build swift-reflection-test.
1 parent 0a73e15 commit 5a30b27

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
@@ -2139,11 +2139,19 @@ function(_add_swift_executable_single name)
21392139
# Find the names of dependency library targets.
21402140
#
21412141
# We don't add the ${ARCH} to the target suffix because we want to link
2142-
# against fat libraries.
2143-
_list_add_string_suffix(
2144-
"${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES}"
2145-
"-${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}"
2146-
SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES_TARGETS)
2142+
# against fat libraries. This only works for the Darwin targets as MachO is
2143+
# the only format with the fat libraries.
2144+
if(${SWIFTEXE_SINGLE_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
2145+
_list_add_string_suffix(
2146+
"${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES}"
2147+
"-${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}"
2148+
SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES_TARGETS)
2149+
else()
2150+
_list_add_string_suffix(
2151+
"${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES}"
2152+
"-${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}-${SWIFTEXE_SINGLE_ARCHITECTURE}"
2153+
SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES_TARGETS)
2154+
endif()
21472155

21482156
handle_swift_sources(
21492157
dependency_target

0 commit comments

Comments
 (0)