summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-09-28 20:47:36 (GMT)
committerBrad King <brad.king@kitware.com>2020-09-30 15:58:44 (GMT)
commitb6c60f14b6df53d8cb6fe442d801fdae50ddf287 (patch)
treec90ce25ec8c6e5fb66c514869474b465aa6bfa04 /Source/cmGeneratorTarget.cxx
parent383e81aa60312433d25d68ab0ef4991aa3b869c1 (diff)
downloadCMake-b6c60f14b6df53d8cb6fe442d801fdae50ddf287.zip
CMake-b6c60f14b6df53d8cb6fe442d801fdae50ddf287.tar.gz
CMake-b6c60f14b6df53d8cb6fe442d801fdae50ddf287.tar.bz2
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
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 8589ab1..20a137a 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3193,6 +3193,9 @@ void cmGeneratorTarget::GetAppleArchs(const std::string& config,
if (archs) {
cmExpandList(*archs, archVec);
}
+ if (archVec.empty()) {
+ this->Makefile->GetDefExpandList("_CMAKE_APPLE_ARCHS_DEFAULT", archVec);
+ }
}
void cmGeneratorTarget::AddCUDAArchitectureFlags(std::string& flags) const