From 940fc629628f505e57c0d3a7a524a8447ee6f49b Mon Sep 17 00:00:00 2001
From: Raul Tambre <raul@tambre.ee>
Date: Fri, 21 Aug 2020 10:57:32 +0300
Subject: macOS: Respect OSX_ARCHITECTURES for ASM

Fixes #20771.
---
 Help/release/dev/asm-osx-architectures.rst | 5 +++++
 Source/cmLocalGenerator.cxx                | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)
 create mode 100644 Help/release/dev/asm-osx-architectures.rst

diff --git a/Help/release/dev/asm-osx-architectures.rst b/Help/release/dev/asm-osx-architectures.rst
new file mode 100644
index 0000000..d8d0660
--- /dev/null
+++ b/Help/release/dev/asm-osx-architectures.rst
@@ -0,0 +1,5 @@
+asm-osx-architectures
+---------------------
+
+* The :prop_tgt:`OSX_ARCHITECTURES` target property is now respected for the
+  ``ASM`` language.
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 2380cce..5b15713 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1875,8 +1875,9 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
   if (this->Makefile->IsOn("APPLE") && this->EmitUniversalBinaryFlags) {
     std::vector<std::string> archs;
     target->GetAppleArchs(config, archs);
-    if (!archs.empty() && !lang.empty() &&
-        (lang[0] == 'C' || lang[0] == 'F' || lang[0] == 'O')) {
+    if (!archs.empty() &&
+        (lang == "C" || lang == "CXX" || lang == "OBJ" || lang == "OBJCXX" ||
+         cmHasLiteralPrefix(lang, "ASM"))) {
       for (std::string const& arch : archs) {
         if (filterArch.empty() || filterArch == arch) {
           flags += " -arch ";
-- 
cgit v0.12