diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
index 01ec4b6de651..3821ef8b448c 100644
--- a/libunwind/src/CMakeLists.txt
+++ b/libunwind/src/CMakeLists.txt
@@ -24,6 +24,13 @@ set(LIBUNWIND_ASM_SOURCES
     UnwindRegistersRestore.S
     UnwindRegistersSave.S
     )
+if (MINGW)
+  # CMake doesn't build assembly sources for windows/gnu targets properly
+  # (up to current CMake, 3.16), so treat them as C files.
+  set_source_files_properties(${LIBUNWIND_ASM_SOURCES}
+                              PROPERTIES
+                                LANGUAGE C)
+endif()
 
 set(LIBUNWIND_HEADERS
     AddressSpace.hpp