File tree 2 files changed +18
-14
lines changed
2 files changed +18
-14
lines changed Original file line number Diff line number Diff line change @@ -147,12 +147,22 @@ set(CLANG_COMPILER_VERSION "" CACHE STRING
147
147
"The internal version of the Clang compiler" )
148
148
149
149
# Indicate whether Swift should attempt to use the lld linker.
150
- set (SWIFT_ENABLE_LLD_LINKER TRUE CACHE BOOL
150
+ if (CMAKE_SYSTEM_NAME STREQUAL Windows AND NOT CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
151
+ set (SWIFT_ENABLE_LLD_LINKER_default TRUE )
152
+ else ()
153
+ set (SWIFT_ENABLE_LLD_LINKER_default FALSE )
154
+ endif ()
155
+ set (SWIFT_ENABLE_LLD_LINKER ${SWIFT_ENABLE_LLD_LINKER_default} CACHE BOOL
151
156
"Enable using the lld linker when available" )
152
157
153
158
# Indicate whether Swift should attempt to use the gold linker.
154
159
# This is not used on Darwin.
155
- set (SWIFT_ENABLE_GOLD_LINKER TRUE CACHE BOOL
160
+ if (CMAKE_SYSTEM_NAME STREQUAL Darwin OR CMAKE_SYSTEM_NAME STREQUAL Windows)
161
+ set (SWIFT_ENABLE_GOLD_LINKER_default FALSE )
162
+ else ()
163
+ set (SWIFT_ENABLE_GOLD_LINKER_default TRUE )
164
+ endif ()
165
+ set (SWIFT_ENABLE_GOLD_LINKER ${SWIFT_ENABLE_GOLD_LINKER_default} CACHE BOOL
156
166
"Enable using the gold linker when available" )
157
167
158
168
set (SWIFT_TOOLS_ENABLE_LTO OFF CACHE STRING "Build Swift tools with LTO. One
Original file line number Diff line number Diff line change @@ -403,18 +403,12 @@ function(_add_host_variant_link_flags target)
403
403
endif ()
404
404
405
405
if (NOT SWIFT_COMPILER_IS_MSVC_LIKE)
406
- # FIXME: On Apple platforms, find_program needs to look for "ld64.lld"
407
- find_program (LDLLD_PATH "ld.lld" )
408
- if ((SWIFT_ENABLE_LLD_LINKER AND LDLLD_PATH AND NOT APPLE ) OR
409
- (SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS AND NOT CMAKE_SYSTEM_NAME STREQUAL WINDOWS))
410
- target_link_options (${target} PRIVATE -fuse-ld=lld)
411
- elseif (SWIFT_ENABLE_GOLD_LINKER AND
412
- "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK} _OBJECT_FORMAT}" STREQUAL "ELF" )
413
- if (CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
414
- target_link_options (${target} PRIVATE -fuse-ld=gold.exe)
415
- else ()
416
- target_link_options (${target} PRIVATE -fuse-ld=gold)
417
- endif ()
406
+ if (SWIFT_ENABLE_LLD_LINKER)
407
+ target_link_options (${target} PRIVATE
408
+ -fuse-ld=lld$<$<STREQUAL :${CMAKE_HOST_SYSTEM_NAME} ,Windows>:.exe>)
409
+ elseif (SWIFT_ENABLE_GOLD_LINKER)
410
+ target_link_options (${target} PRIVATE
411
+ -fuse-ld=gold$<$<STREQUAL :${CMAKE_HOST_SYSTEM_NAME} ,Windows>:.exe>)
418
412
endif ()
419
413
endif ()
420
414
You can’t perform that action at this time.
0 commit comments