From 1dd0eae4fc54e2c15176088ac6b9b7b42802b6f6 Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Fri, 18 Jun 2021 13:56:02 -0400
Subject: [PATCH] Tests: Fix xcode version detection for Xcode 13 on ARM

Running `xcode -version` on an ARM box prints content to stderr:

    objc[...]: Class ... is implemented in both...
    One of the two will be used. Which one is undefined.

Capture and parse only stdout.  Otherwise we might configure test
behavior for the wrong version of Xcode.
---
 Tests/BuildDepends/Project/CMakeLists.txt | 2 +-
 Tests/CMakeLists.txt                      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt
index c2576f3e3f9..7fddf4b03eb 100644
--- a/Tests/BuildDepends/Project/CMakeLists.txt
+++ b/Tests/BuildDepends/Project/CMakeLists.txt
@@ -8,7 +8,7 @@ if(APPLE)
   else()
     execute_process(
       COMMAND xcodebuild -version
-      OUTPUT_VARIABLE _version ERROR_VARIABLE _version
+      OUTPUT_VARIABLE _version ERROR_VARIABLE _version_err
       )
     if(_version MATCHES "^Xcode ([0-9]+(\\.[0-9]+)*)")
       set(CMake_TEST_XCODE_VERSION "${CMAKE_MATCH_1}")
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 8e7c04fbd0c..bb83feab413 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -321,7 +321,7 @@ if(BUILD_TESTING)
     else()
       execute_process(
         COMMAND xcodebuild -version
-        OUTPUT_VARIABLE _version ERROR_VARIABLE _version
+        OUTPUT_VARIABLE _version ERROR_VARIABLE _version_err
         )
       if(_version MATCHES "^Xcode ([0-9]+(\\.[0-9]+)*)")
         set(CMake_TEST_XCODE_VERSION "${CMAKE_MATCH_1}")
-- 
GitLab