From b6c60f14b6df53d8cb6fe442d801fdae50ddf287 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 28 Sep 2020 16:47:36 -0400 Subject: macOS: Default to arm64 architecture on Apple Silicon hosts Detect `arm64` hardware using a method that pierces Rosetta. If `CMAKE_OSX_ARCHITECTURES` is not set, pass explicit flags to the toolchain to use `arm64` instead of letting the toolchain pick. Fixes: #20989 --- Source/cmGlobalXCodeGenerator.cxx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Source/cmGlobalXCodeGenerator.cxx') diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index b57bdbca6a..71b52ec0f7 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -4023,6 +4023,10 @@ void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf) mf->GetDefExpandList("CMAKE_OSX_ARCHITECTURES", this->Architectures); } + if (this->Architectures.empty()) { + mf->GetDefExpandList("_CMAKE_APPLE_ARCHS_DEFAULT", this->Architectures); + } + if (this->Architectures.empty()) { // With no ARCHS we use ONLY_ACTIVE_ARCH and possibly a // platform-specific default ARCHS placeholder value. -- cgit v1.2.1