@@ -1403,18 +1403,27 @@ function(_add_swift_library_single target name)
1403
1403
# Include LLVM Bitcode slices for iOS, Watch OS, and Apple TV OS device libraries.
1404
1404
if (SWIFT_EMBED_BITCODE_SECTION AND NOT SWIFTLIB_SINGLE_DONT_EMBED_BITCODE)
1405
1405
if (${SWIFTLIB_SINGLE_SDK} MATCHES "(I|TV|WATCH)OS" )
1406
- target_link_options (${target} PRIVATE
1407
- "LINKER:-bitcode_bundle"
1408
- "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)
1406
+ # The two branches of this if statement accomplish the same end result
1407
+ # We are simply accounting for the fact that on CMake < 3.16
1408
+ # using a generator expression to
1409
+ # specify a LINKER: argument does not work,
1410
+ # since that seems not to allow the LINKER: prefix to be
1411
+ # evaluated (i.e. it will be added as-is to the linker parameters)
1412
+ if (CMAKE_VERSION VERSION_LESS 3.16)
1413
+ target_link_options (${target} PRIVATE
1414
+ "LINKER:-bitcode_bundle"
1415
+ "LINKER:-lto_library,${LLVM_LIBRARY_DIR} /libLTO.dylib" )
1416
+
1414
1417
if (SWIFT_EMBED_BITCODE_SECTION_HIDE_SYMBOLS)
1415
1418
target_link_options (${target} PRIVATE
1416
1419
"LINKER:-bitcode_hide_symbols" )
1417
1420
endif ()
1421
+ else ()
1422
+ target_link_options (${target} PRIVATE
1423
+ "LINKER:-bitcode_bundle"
1424
+ $<$<BOOL :SWIFT_EMBED_BITCODE_SECTION_HIDE_SYMBOLS>:"LINKER:-bitcode_hide_symbols" >
1425
+ "LINKER:-lto_library,${LLVM_LIBRARY_DIR} /libLTO.dylib" )
1426
+ endif ()
1418
1427
endif ()
1419
1428
endif ()
1420
1429
endif ()
0 commit comments