Skip to content

Commit c60c69c

Browse files
committed
[build] avoid use generator expression to add linker parameter
Generator expressions seem not to allow the `LINKER:` prefix to be expanded correctly when used in `target_link_options`. To solve this, undo the change from #29451 and instead use an `if` statement to add the flag when needed. Addresses rdar://problem/59117166
1 parent 08dca46 commit c60c69c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1405,8 +1405,16 @@ function(_add_swift_library_single target name)
14051405
if(${SWIFTLIB_SINGLE_SDK} MATCHES "(I|TV|WATCH)OS")
14061406
target_link_options(${target} PRIVATE
14071407
"LINKER:-bitcode_bundle"
1408-
$<$<BOOL:SWIFT_EMBED_BITCODE_SECTION_HIDE_SYMBOLS>:"LINKER:-bitcode_hide_symbols">
14091408
"LINKER:-lto_library,${LLVM_LIBRARY_DIR}/libLTO.dylib")
1409+
1410+
# Please note that using a generator expression to fit
1411+
# this in a single target_link_options does not work,
1412+
# since that seems not to allow the LINKER: prefix to be
1413+
# evaluated (i.e. it will be added as-is to the linker parameters)
1414+
if(SWIFT_EMBED_BITCODE_SECTION_HIDE_SYMBOLS)
1415+
target_link_options(${target} PRIVATE
1416+
"LINKER:-bitcode_hide_symbols")
1417+
endif()
14101418
endif()
14111419
endif()
14121420
endif()

0 commit comments

Comments
 (0)