Skip to content

Commit 85d42d1

Browse files
authored
Merge pull request #73383 from hamishknight/fix-stdlibless-build
[cmake] Only check HostCompatibilityLibs for bootstrapping builds
2 parents b7a84da + 37dc7ce commit 85d42d1

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -467,16 +467,20 @@ function(_add_swift_runtime_link_flags target relpath_to_lib_dir bootstrapping)
467467
468468
set(sdk_dir "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}/usr/lib/swift")
469469
470-
# HostCompatibilityLibs is defined as an interface library that
471-
# does not generate any concrete build target
472-
# (https://cmake.org/cmake/help/latest/command/add_library.html#interface-libraries)
473-
# In order to specify a dependency to it using `add_dependencies`
474-
# we need to manually "expand" its underlying targets
475-
get_property(compatibility_libs
476-
TARGET HostCompatibilityLibs
477-
PROPERTY INTERFACE_LINK_LIBRARIES)
478-
set(compatibility_libs_path
479-
"${SWIFTLIB_DIR}/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}/${SWIFT_HOST_VARIANT_ARCH}")
470+
# Note we only check this for bootstrapping, since you ought to
471+
# be able to build using hosttools with the stdlib disabled.
472+
if(ASRLF_BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*")
473+
# HostCompatibilityLibs is defined as an interface library that
474+
# does not generate any concrete build target
475+
# (https://cmake.org/cmake/help/latest/command/add_library.html#interface-libraries)
476+
# In order to specify a dependency to it using `add_dependencies`
477+
# we need to manually "expand" its underlying targets
478+
get_property(compatibility_libs
479+
TARGET HostCompatibilityLibs
480+
PROPERTY INTERFACE_LINK_LIBRARIES)
481+
set(compatibility_libs_path
482+
"${SWIFTLIB_DIR}/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}/${SWIFT_HOST_VARIANT_ARCH}")
483+
endif()
480484
481485
# If we found a swift compiler and are going to use swift code in swift
482486
# host side tools but link with clang, add the appropriate -L paths so we

0 commit comments

Comments
 (0)