Xcode: OSX_DEPLOYMENT_TARGET should depend on target architecture
When building a CMake project for multiple architectures (x86_64 and arm64) on Mac it should be possible to set the minimum macOS version depending on the architecture.
Reasoning:
The first macOS version ever supporting the Apple Silicon (ARM) architecture was macOS 11.0. Accordingly all sources compiled for Apple Silicon need to be compiled with '-target arm64-apple-macos11.0'
. However, the x86_64 variant in the universal binary should be able to support macOS versions down to 12.0. Currently the OSX_DEPLOYMENT_TARGET is set unconditionally, which either:
- leads to compilation errors when building for arm64 against the 11.0 or higher SDKs
- prevents x86_64 code to run on a version older than 11.0
It should therefore be possible to specify the macOS target version based on the target architecture.
Edited by Brad King