Skip to content

Commit 10a32d5

Browse files
hamishknightartemcm
authored andcommitted
[cmake] Only check HostCompatibilityLibs for bootstrapping builds
Locally I build debug builds without the standard library, using a copy of the stdlib in my release build. This hit a CMake error here since the `HostCompatibilityLibs` target isn't defined. Update to only access it when doing a bootstrapping build.
1 parent f330374 commit 10a32d5

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
@@ -473,16 +473,20 @@ function(_add_swift_runtime_link_flags target relpath_to_lib_dir bootstrapping)
473473
474474
set(sdk_dir "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}/usr/lib/swift")
475475
476-
# HostCompatibilityLibs is defined as an interface library that
477-
# does not generate any concrete build target
478-
# (https://cmake.org/cmake/help/latest/command/add_library.html#interface-libraries)
479-
# In order to specify a dependency to it using `add_dependencies`
480-
# we need to manually "expand" its underlying targets
481-
get_property(compatibility_libs
482-
TARGET HostCompatibilityLibs
483-
PROPERTY INTERFACE_LINK_LIBRARIES)
484-
set(compatibility_libs_path
485-
"${SWIFTLIB_DIR}/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}/${SWIFT_HOST_VARIANT_ARCH}")
476+
# Note we only check this for bootstrapping, since you ought to
477+
# be able to build using hosttools with the stdlib disabled.
478+
if(ASRLF_BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*")
479+
# HostCompatibilityLibs is defined as an interface library that
480+
# does not generate any concrete build target
481+
# (https://cmake.org/cmake/help/latest/command/add_library.html#interface-libraries)
482+
# In order to specify a dependency to it using `add_dependencies`
483+
# we need to manually "expand" its underlying targets
484+
get_property(compatibility_libs
485+
TARGET HostCompatibilityLibs
486+
PROPERTY INTERFACE_LINK_LIBRARIES)
487+
set(compatibility_libs_path
488+
"${SWIFTLIB_DIR}/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}/${SWIFT_HOST_VARIANT_ARCH}")
489+
endif()
486490
487491
# If we found a swift compiler and are going to use swift code in swift
488492
# host side tools but link with clang, add the appropriate -L paths so we

0 commit comments

Comments
 (0)