From d664d95ebaa4f1eeec5e38eb6b544009891de919 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Sun, 18 Apr 2021 17:01:49 +0100 Subject: [PATCH] Mac M1 build update proposal. To avoid passing explicitally the arch by default, setting based on the host assumption. --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 72b32a3b2..ef8821f95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,11 @@ ADD_DEFINITIONS("-D_CRT_SECURE_NO_DEPRECATE IF(APPLE) IF("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "") - SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;x86_64" CACHE STRING "Build architectures for Mac OS X" FORCE) + IF(NOT "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "^arm") + SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;x86_64" CACHE STRING "Build architectures for Mac OS X" FORCE) + ELSE() + SET(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "Build architectures for Mac OS X" FORCE) + ENDIF() ENDIF() ENDIF(APPLE)