macOS: Suppress default '-arch arm64' with CMAKE_<LANG>_COMPILER_TARGET
Since !5291 (merged) we add -arch arm64
by
default on Apple Silicon hosts if CMAKE_OSX_ARCHITECTURES
is not set.
This is necessary to prevent the toolchain from selecting its own
default architecture based on that of the build tool (e.g., x86_64
).
If CMAKE_<LANG>_COMPILER_TARGET
is set, its -target
flag tells the
compiler what architecture to use, so do not add -arch arm64
.
Fixes: #24599 (closed)