[libunwind][CMake] Treat S files as C to work around CMake bug.
The OSX_ARCHITECTURES property is supposed to add the -arch flag when
targeting Apple platforms. However, due to a bug in CMake
(https://github.com/Kitware/CMake/blob/master/Source/cmLocalGenerator.cxx#L1780),
this does not apply to assembly files. This results in a linker error
when trying to build libunwind for i386 on MacOS.
rdar://59642189
GitOrigin-RevId: d4ded05ba851304b26a437896bc3962ef56f62cb
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3821ef8..8f79b1c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -24,9 +24,11 @@
UnwindRegistersRestore.S
UnwindRegistersSave.S
)
-if (MINGW)
+if (MINGW OR APPLE)
# CMake doesn't build assembly sources for windows/gnu targets properly
# (up to current CMake, 3.16), so treat them as C files.
+ # Additionally, CMake ignores OSX_ARCHITECTURE for ASM files when targeting
+ # Apple platforms.
set_source_files_properties(${LIBUNWIND_ASM_SOURCES}
PROPERTIES
LANGUAGE C)