Skip to content

Commit cf4cdf4

Browse files
committed
[cmake] Now that we link with cxx and set the right load paths, use appropriate backdeployment target for swiftc.
Before a8ae952, we could not do this since we would fail to link since we didn't pass to clang the path to the toolchain dir when the compatibility libraries live.
1 parent 21a25c8 commit cf4cdf4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,14 @@ function(_add_host_variant_c_compile_link_flags name)
9292
MACCATALYST_BUILD_FLAVOR ""
9393
DEPLOYMENT_VERSION "${DEPLOYMENT_VERSION}")
9494
target_compile_options(${name} PRIVATE $<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:-target;${target}>)
95-
target_link_options(${name} PRIVATE -target;${target})
95+
target_link_options(${name} PRIVATE $<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:-target;${target}>)
96+
endif()
97+
98+
if (CMAKE_Swift_COMPILER)
99+
get_target_triple(target target_variant "${SWIFT_HOST_VARIANT_SDK}" "${SWIFT_HOST_VARIANT_ARCH}"
100+
MACCATALYST_BUILD_FLAVOR ""
101+
DEPLOYMENT_VERSION "${DEPLOYMENT_VERSION}")
102+
target_compile_options(${name} PRIVATE $<$<COMPILE_LANGUAGE:Swift>:-target;${target}>)
96103
endif()
97104

98105
set(_sysroot

0 commit comments

Comments
 (0)