summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-12-11 18:05:12 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-12-11 18:05:34 (GMT)
commit794aa36b1fe945c25822108dbf3bcaa4c89f26d7 (patch)
tree97d0622c5cd7ac0be8e137b7cd0ab52c494e0f79 /Tests/CMakeLists.txt
parent0d9c43281fa4e39b18f63af3619fb89280bde722 (diff)
parentb7f0327dcd4032c6a118825adcfdc8dab6295e7f (diff)
downloadCMake-794aa36b1fe945c25822108dbf3bcaa4c89f26d7.zip
CMake-794aa36b1fe945c25822108dbf3bcaa4c89f26d7.tar.gz
CMake-794aa36b1fe945c25822108dbf3bcaa4c89f26d7.tar.bz2
Merge topic 'apple-silicon-host-arch'
b7f0327dcd Tests: Cover macOS host architecture selection on Apple Silicon hosts 5f882f6ce5 macOS: Offer control over host architecture on Apple Silicon hosts Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5589
Diffstat (limited to 'Tests/CMakeLists.txt')
-rw-r--r--Tests/CMakeLists.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 14095dd..2a59d66 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -228,6 +228,22 @@ if(BUILD_TESTING)
endif()
endif()
+ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT DEFINED CMake_TEST_APPLE_SILICON)
+ execute_process(COMMAND sysctl -q hw.optional.arm64
+ OUTPUT_VARIABLE _sysctl_stdout
+ ERROR_VARIABLE _sysctl_stderr
+ RESULT_VARIABLE _sysctl_result
+ )
+ if(_sysctl_result EQUAL 0 AND _sysctl_stdout MATCHES "hw.optional.arm64: 1")
+ set(CMake_TEST_APPLE_SILICON 1)
+ else()
+ set(CMake_TEST_APPLE_SILICON 0)
+ endif()
+ unset(_sysctl_result)
+ unset(_sysctl_stderr)
+ unset(_sysctl_stdout)
+ endif()
+
#---------------------------------------------------------------------------
# Add tests below here.