Skip to content

Commit d8de5ba

Browse files
authored
[build] set linker parameters in a single way (for stdlib) (#30596)
Match the same fix as #30339 for `AddSwiftStdlib.cmake`. Addresses rdar://problem/60791444
1 parent 1be86ad commit d8de5ba

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -802,26 +802,18 @@ function(_add_swift_target_library_single target name)
802802
# Include LLVM Bitcode slices for iOS, Watch OS, and Apple TV OS device libraries.
803803
if(SWIFT_EMBED_BITCODE_SECTION AND NOT SWIFTLIB_SINGLE_DONT_EMBED_BITCODE)
804804
if(${SWIFTLIB_SINGLE_SDK} MATCHES "(I|TV|WATCH)OS")
805-
# The two branches of this if statement accomplish the same end result
806-
# We are simply accounting for the fact that on CMake < 3.16
807-
# using a generator expression to
808-
# specify a LINKER: argument does not work,
805+
# Please note that using a generator expression to fit
806+
# this in a single target_link_options does not work
807+
# (at least in CMake 3.15 and 3.16),
809808
# since that seems not to allow the LINKER: prefix to be
810809
# evaluated (i.e. it will be added as-is to the linker parameters)
811-
if(CMAKE_VERSION VERSION_LESS 3.16)
812-
target_link_options(${target} PRIVATE
813-
"LINKER:-bitcode_bundle"
814-
"LINKER:-lto_library,${LLVM_LIBRARY_DIR}/libLTO.dylib")
810+
target_link_options(${target} PRIVATE
811+
"LINKER:-bitcode_bundle"
812+
"LINKER:-lto_library,${LLVM_LIBRARY_DIR}/libLTO.dylib")
815813

816-
if(SWIFT_EMBED_BITCODE_SECTION_HIDE_SYMBOLS)
817-
target_link_options(${target} PRIVATE
818-
"LINKER:-bitcode_hide_symbols")
819-
endif()
820-
else()
814+
if(SWIFT_EMBED_BITCODE_SECTION_HIDE_SYMBOLS)
821815
target_link_options(${target} PRIVATE
822-
"LINKER:-bitcode_bundle"
823-
$<$<BOOL:SWIFT_EMBED_BITCODE_SECTION_HIDE_SYMBOLS>:"LINKER:-bitcode_hide_symbols">
824-
"LINKER:-lto_library,${LLVM_LIBRARY_DIR}/libLTO.dylib")
816+
"LINKER:-bitcode_hide_symbols")
825817
endif()
826818
endif()
827819
endif()

0 commit comments

Comments
 (0)