Skip to content

Override -arch For Stdlib Targets #41119

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

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 4 additions & 1 deletion stdlib/cmake/modules/AddSwiftStdlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ function(_add_target_variant_c_compile_link_flags)
# of options by target_compile_options -- this way no undesired
# side effects are introduced should a new search path be added.
list(APPEND result
"-arch" "${CFLAGS_ARCH}"
"-F${SWIFT_SDK_${CFLAGS_SDK}_PATH}/../../../Developer/Library/Frameworks")
endif()

Expand Down Expand Up @@ -1203,6 +1202,10 @@ function(add_swift_target_library_single target name)

list(APPEND library_search_directories "${SWIFT_SDK_${sdk}_ARCH_${arch}_PATH}/usr/lib/swift")

# Override -arch on macOS. This is crucial for Apple Silicon, where CMake forces
# the *host* architecture to appear as the argument to -arch otherwise.
set_property(TARGET ${target} PROPERTY OSX_ARCHITECTURES "${SWIFTLIB_SINGLE_ARCHITECTURE}")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edymtt I'm not sure if this is the appropriate place to put it, but we aren't passing target down to _add_target_variant_c_compile_link_flags AFAICT so it's a bit tough to move there.


# Add variant-specific flags.
set(build_type "${SWIFT_STDLIB_BUILD_TYPE}")
set(enable_assertions "${SWIFT_STDLIB_ASSERTIONS}")
Expand Down