Skip to content

Commit ed8f295

Browse files
authored
Merge pull request #38445 from edymtt/explicitly-set-osx-architecture-macos-5.5
[5.5][build] explicitly set OSX_ARCHITECTURES for targets in stdlib
2 parents b059298 + a3d97ba commit ed8f295

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2035,6 +2035,16 @@ function(add_swift_target_library name)
20352035
list(APPEND THIN_INPUT_TARGETS ${VARIANT_NAME})
20362036
endif()
20372037
endif()
2038+
2039+
if(sdk IN_LIST SWIFT_APPLE_PLATFORMS)
2040+
# In the past, we relied on unsetting globally
2041+
# CMAKE_OSX_ARCHITECTURES to ensure that CMake would
2042+
# not add the -arch flag
2043+
# This is no longer the case when running on Apple Silicon,
2044+
# when CMake will enforce a default (see
2045+
# https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5291)
2046+
set_property(TARGET ${VARIANT_NAME} PROPERTY OSX_ARCHITECTURES "${arch}")
2047+
endif()
20382048
endforeach()
20392049

20402050
# Configure module-only targets
@@ -2473,6 +2483,14 @@ function(add_swift_target_executable name)
24732483
endif()
24742484

24752485
if(${sdk} IN_LIST SWIFT_APPLE_PLATFORMS)
2486+
# In the past, we relied on unsetting globally
2487+
# CMAKE_OSX_ARCHITECTURES to ensure that CMake would
2488+
# not add the -arch flag
2489+
# This is no longer the case when running on Apple Silicon,
2490+
# when CMake will enforce a default (see
2491+
# https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5291)
2492+
set_property(TARGET ${VARIANT_NAME} PROPERTY OSX_ARCHITECTURES "${arch}")
2493+
24762494
add_custom_command_target(unused_var2
24772495
COMMAND "codesign" "-f" "-s" "-" "${SWIFT_RUNTIME_OUTPUT_INTDIR}/${VARIANT_NAME}"
24782496
CUSTOM_TARGET_NAME "${VARIANT_NAME}_signed"

0 commit comments

Comments
 (0)