@@ -1346,18 +1346,6 @@ function(add_swift_target_library_single target name)
1346
1346
target_link_options (${target} PRIVATE
1347
1347
"LINKER:-current_version,${SWIFT_COMPILER_VERSION} " )
1348
1348
endif ()
1349
-
1350
- # In the past, we relied on unsetting globally
1351
- # CMAKE_OSX_ARCHITECTURES to ensure that CMake
1352
- # would# not add the -arch flag. This is no longer
1353
- # the case when running on Apple Silicon, when
1354
- # CMake will enforce a default (see
1355
- # https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5291)
1356
- set_property (TARGET ${target} PROPERTY OSX_ARCHITECTURES "${SWIFTLIB_SINGLE_ARCHITECTURE} " )
1357
- if (TARGET "${target_static} " )
1358
- set_property (TARGET ${target_static} PROPERTY OSX_ARCHITECTURES "${SWIFTLIB_SINGLE_ARCHITECTURE} " )
1359
- endif ()
1360
-
1361
1349
# Include LLVM Bitcode slices for iOS, Watch OS, and Apple TV OS device libraries.
1362
1350
if (SWIFT_EMBED_BITCODE_SECTION AND NOT SWIFTLIB_SINGLE_DONT_EMBED_BITCODE )
1363
1351
if ("${SWIFTLIB_SINGLE_SDK} " STREQUAL "IOS" OR
@@ -1383,6 +1371,20 @@ function(add_swift_target_library_single target name)
1383
1371
# emitting warnings about global initializers when it compiles the code.
1384
1372
list (APPEND swiftlib_link_flags_all "-Xlinker -no_warn_inits" )
1385
1373
endif ()
1374
+
1375
+ if (${SWIFTLIB_SINGLE_SDK} IN_LIST SWIFT_APPLE_PLATFORMS )
1376
+ # In the past, we relied on unsetting globally
1377
+ # CMAKE_OSX_ARCHITECTURES to ensure that CMake
1378
+ # would not add the -arch flag. This is no longer
1379
+ # the case when running on Apple Silicon, when
1380
+ # CMake will enforce a default (see
1381
+ # https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5291)
1382
+ set_property (TARGET ${target} PROPERTY OSX_ARCHITECTURES "${SWIFTLIB_SINGLE_ARCHITECTURE} " )
1383
+ if (TARGET "${target_static} " )
1384
+ set_property (TARGET ${target_static} PROPERTY OSX_ARCHITECTURES "${SWIFTLIB_SINGLE_ARCHITECTURE} " )
1385
+ endif ()
1386
+ endif ()
1387
+
1386
1388
target_link_libraries (${target} PRIVATE
1387
1389
${link_libraries} )
1388
1390
target_link_directories (${target} PRIVATE
0 commit comments