Limit the CMake -isysroot assembly workaround to older CMake

It was fixed in CMake 3.19 with
https://gitlab.kitware.com/cmake/cmake/-/issues/20771

Change-Id: Ia76ab6690e233bc650e11a79db381c00f21c83a1
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/56568
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a1a008..1cb7226 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -420,8 +420,9 @@
   else()
     enable_language(ASM)
     set(OPENSSL_ASM TRUE)
-    # CMake does not add -isysroot and -arch flags to assembly.
-    if(APPLE)
+    # Work around https://gitlab.kitware.com/cmake/cmake/-/issues/20771 in older
+    # CMake versions.
+    if(APPLE AND CMAKE_VERSION VERSION_LESS 3.19)
       if(CMAKE_OSX_SYSROOT)
         set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -isysroot \"${CMAKE_OSX_SYSROOT}\"")
       endif()
diff --git a/util/generate_build_files.py b/util/generate_build_files.py
index ca173c8..c221f04 100644
--- a/util/generate_build_files.py
+++ b/util/generate_build_files.py
@@ -457,8 +457,9 @@
   else()
     enable_language(ASM)
     set(OPENSSL_ASM TRUE)
-    # CMake does not add -isysroot and -arch flags to assembly.
-    if(APPLE)
+    # Work around https://gitlab.kitware.com/cmake/cmake/-/issues/20771 in older
+    # CMake versions.
+    if(APPLE AND CMAKE_VERSION VERSION_LESS 3.19)
       if(CMAKE_OSX_SYSROOT)
         set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -isysroot \"${CMAKE_OSX_SYSROOT}\"")
       endif()