@@ -1403,18 +1403,27 @@ function(_add_swift_library_single target name)
14031403 # Include LLVM Bitcode slices for iOS, Watch OS, and Apple TV OS device libraries.
14041404 if (SWIFT_EMBED_BITCODE_SECTION AND NOT SWIFTLIB_SINGLE_DONT_EMBED_BITCODE)
14051405 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+
14141417 if (SWIFT_EMBED_BITCODE_SECTION_HIDE_SYMBOLS)
14151418 target_link_options (${target} PRIVATE
14161419 "LINKER:-bitcode_hide_symbols" )
14171420 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 ()
14181427 endif ()
14191428 endif ()
14201429 endif ()
0 commit comments