@@ -469,7 +469,7 @@ function(_add_swift_runtime_link_flags target relpath_to_lib_dir bootstrapping)
469
469
470
470
# Note we only check this for bootstrapping, since you ought to
471
471
# be able to build using hosttools with the stdlib disabled.
472
- if(ASRLF_BOOTSTRAPPING_MODE MATCHES " BOOTSTRAPPING.* ")
472
+ if(ASRLF_BOOTSTRAPPING_MODE MATCHES " BOOTSTRAPPING.* " AND SWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT )
473
473
# HostCompatibilityLibs is defined as an interface library that
474
474
# does not generate any concrete build target
475
475
# (https://cmake.org/cmake/help/latest/command/add_library.html#interface-libraries)
@@ -519,12 +519,14 @@ function(_add_swift_runtime_link_flags target relpath_to_lib_dir bootstrapping)
519
519
# Add the SDK directory for the host platform.
520
520
target_link_directories(${target} PRIVATE " ${sdk_dir} ")
521
521
522
- # A backup in case the toolchain doesn't have one of the compatibility libraries.
523
- # We are using on purpose `add_dependencies` instead of `target_link_libraries`,
524
- # since we want to ensure the linker is pulling the matching archives
525
- # only if needed
526
- target_link_directories(${target} PRIVATE " ${compatibility_libs_path} ")
527
- add_dependencies(${target} ${compatibility_libs} )
522
+ if(compatibility_libs_path)
523
+ # A backup in case the toolchain doesn't have one of the compatibility libraries.
524
+ # We are using on purpose `add_dependencies` instead of `target_link_libraries`,
525
+ # since we want to ensure the linker is pulling the matching archives
526
+ # only if needed
527
+ target_link_directories(${target} PRIVATE " ${compatibility_libs_path} ")
528
+ add_dependencies(${target} ${compatibility_libs} )
529
+ endif()
528
530
529
531
# Include the abi stable system stdlib in our rpath.
530
532
set(swift_runtime_rpath " /usr/lib/swift ")
@@ -535,12 +537,14 @@ function(_add_swift_runtime_link_flags target relpath_to_lib_dir bootstrapping)
535
537
get_bootstrapping_swift_lib_dir(bs_lib_dir " ${bootstrapping} ")
536
538
target_link_directories(${target} PRIVATE ${bs_lib_dir} )
537
539
538
- # Required to pick up the built libswiftCompatibility<n>.a libraries
539
- # We are using on purpose `add_dependencies` instead of `target_link_libraries`,
540
- # since we want to ensure the linker is pulling the matching archives
541
- # only if needed
542
- target_link_directories(${target} PRIVATE " ${compatibility_libs_path} ")
543
- add_dependencies(${target} ${compatibility_libs} )
540
+ if(compatibility_libs_path)
541
+ # Required to pick up the built libswiftCompatibility<n>.a libraries
542
+ # We are using on purpose `add_dependencies` instead of `target_link_libraries`,
543
+ # since we want to ensure the linker is pulling the matching archives
544
+ # only if needed
545
+ target_link_directories(${target} PRIVATE " ${compatibility_libs_path} ")
546
+ add_dependencies(${target} ${compatibility_libs} )
547
+ endif()
544
548
545
549
# At runtime link against the built swift libraries from the current
546
550
# bootstrapping stage.
0 commit comments