Skip to content

[build] Pass target to linker for host tools for Apple SDKs #32618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ function(_add_host_variant_c_compile_link_flags name)
MACCATALYST_BUILD_FLAVOR ""
DEPLOYMENT_VERSION "${DEPLOYMENT_VERSION}")
target_compile_options(${name} PRIVATE -target;${target})
target_link_options(${name} PRIVATE -target;${target})
endif()

set(_sysroot
Expand Down Expand Up @@ -470,6 +471,7 @@ function(add_swift_host_library name)

_add_host_variant_c_compile_flags(${name})
_add_host_variant_link_flags(${name})
_add_host_variant_c_compile_link_flags(${name})
_set_target_prefix_and_suffix(${name} "${libkind}" "${SWIFT_HOST_VARIANT_SDK}")

# Set compilation and link flags.
Expand Down Expand Up @@ -526,11 +528,6 @@ function(add_swift_host_library name)
target_link_options(${name} PRIVATE
"LINKER:-current_version,${SWIFT_COMPILER_VERSION}")
endif()

get_target_triple(target target_variant "${SWIFT_HOST_VARIANT_SDK}" "${SWIFT_HOST_VARIANT_ARCH}"
MACCATALYST_BUILD_FLAVOR ""
DEPLOYMENT_VERSION "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_DEPLOYMENT_VERSION}")
target_link_options(${name} PRIVATE -target;${target})
endif()

add_dependencies(dev ${name})
Expand Down Expand Up @@ -575,6 +572,7 @@ function(add_swift_host_tool executable)
add_executable(${executable} ${ASHT_UNPARSED_ARGUMENTS})
_add_host_variant_c_compile_flags(${executable})
_add_host_variant_link_flags(${executable})
_add_host_variant_c_compile_link_flags(${executable})
target_link_directories(${executable} PRIVATE
${SWIFTLIB_DIR}/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR})
add_dependencies(${executable} ${LLVM_COMMON_DEPENDS})
Expand Down