From b09ca009c5821b554b508b227bd62aebb266a4d8 Mon Sep 17 00:00:00 2001 From: eachadea <130280013+eachadea@users.noreply.github.com> Date: Thu, 20 Apr 2023 16:35:17 +0600 Subject: [PATCH] Don't build a universal binary unless -DBUILD_UNIVERSAL=ON --- CMakeLists.txt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 000fd162..ef9c62ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,15 @@ cmake_minimum_required(VERSION 3.16) if(APPLE) - # Build a Universal binary on macOS - # This requires that the found Qt library is compiled as Universal binaries. - set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE) + option(BUILD_UNIVERSAL "Build a Universal binary on macOS" OFF) + if(BUILD_UNIVERSAL) + # Build a Universal binary on macOS + # This requires that the found Qt library is compiled as Universal binaries. + set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE) + else() + # Build for the host architecture on macOS + set(CMAKE_OSX_ARCHITECTURES "${CMAKE_HOST_SYSTEM_PROCESSOR}" CACHE STRING "" FORCE) + endif() endif() set(APP_VERSION_MAJOR 2)