From 9c0f025abfac98ddf6f6ec4bc8d8663c2ee54cf2 Mon Sep 17 00:00:00 2001
From: Charles Giessen <charles@lunarg.com>
Date: Wed, 16 Oct 2024 14:53:21 -0500
Subject: [PATCH] Add Ninja + MSVC/clang-cl workaround for MARMASM

The workaround that enables ninja + MSVC/clang-cl support in the loader
only applied to MASM, which isn't helpful for MARMASM builds.

This workaround did not get added to the build as ninja support was not
considered required for release of the ARM SDK. However, other parties
have started using the ARM build of the loader and reported the issue,
necessitating this fix.
---
 loader/CMakeLists.txt | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt
index 6296ebff1..a9781f846 100644
--- a/loader/CMakeLists.txt
+++ b/loader/CMakeLists.txt
@@ -246,7 +246,11 @@ end
 
         # Work around bug in CMake Ninja + MSVC/clang-cl, see https://discourse.cmake.org/t/building-lib-file-from-asm-cmake-bug/1959
         if (CMAKE_C_COMPILER_ID STREQUAL "MSVC" OR (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_FRONTEND_VARIANT MATCHES "MSVC"))
-            set(CMAKE_ASM_MASM_CREATE_STATIC_LIBRARY "<CMAKE_AR> /OUT:<TARGET> <LINK_FLAGS> <OBJECTS>")
+            if(SYSTEM_PROCESSOR MATCHES "arm")
+                set(CMAKE_ASM_MARMASM_CREATE_STATIC_LIBRARY "<CMAKE_AR> /OUT:<TARGET> <LINK_FLAGS> <OBJECTS>")
+            else()
+                set(CMAKE_ASM_MASM_CREATE_STATIC_LIBRARY "<CMAKE_AR> /OUT:<TARGET> <LINK_FLAGS> <OBJECTS>")
+            endif()
         endif()
     else()
         message(WARNING "Could not find working ${} assembler\n${ASM_FAILURE_MSG}")