[libunwind] d4ded05 - [libunwind][CMake] Treat S files as C to work around CMake bug.

Michael Spencer via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 20 15:26:39 PST 2020


Author: Michael Spencer
Date: 2020-02-20T15:26:09-08:00
New Revision: d4ded05ba851304b26a437896bc3962ef56f62cb

URL: https://github.com/llvm/llvm-project/commit/d4ded05ba851304b26a437896bc3962ef56f62cb
DIFF: https://github.com/llvm/llvm-project/commit/d4ded05ba851304b26a437896bc3962ef56f62cb.diff

LOG: [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

Added: 
    

Modified: 
    libunwind/src/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
index 3821ef8b448c..8f79b1cf8740 100644
--- a/libunwind/src/CMakeLists.txt
+++ b/libunwind/src/CMakeLists.txt
@@ -24,9 +24,11 @@ set(LIBUNWIND_ASM_SOURCES
     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)


        


More information about the cfe-commits mailing list