From fb0e03f262c74f025b19f9748fa720e83f04a179 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Tue, 8 Jul 2025 06:47:47 +0300
Subject: [PATCH] fix ARM64 linkage with Visual Studio >= 17.14 when SDL_LIBC
is disabled
Reference issue: https://github.com/libsdl-org/SDL/issues/13254
(cherry picked from commit 2fb6abb9ad27cd0948a47fd53ced0ab138d7d12a)
---
CMakeLists.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f66b7726054d4..8898be36a2d2f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -654,6 +654,11 @@ if(MSVC)
# Mark SDL3.dll as compatible with Control-flow Enforcement Technology (CET)
sdl_shared_link_options("-CETCOMPAT")
endif()
+
+ # for VS >= 17.14 targeting ARM64: inline the Interlocked funcs
+ if(MSVC_VERSION GREATER 1943 AND SDL_CPU_ARM64 AND NOT SDL_LIBC)
+ sdl_compile_options(PRIVATE "/forceInterlockedFunctions-")
+ endif()
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")