mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Since commit b6c60f14b6 (macOS: Default to arm64 architecture on Apple
Silicon hosts, 2020-09-28, v3.19.0-rc1~63^2) 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
6 lines
193 B
CMake
6 lines
193 B
CMake
enable_language(C)
|
|
if(NOT CMAKE_OSX_ARCHITECTURES STREQUAL "")
|
|
message(FATAL_ERROR "CMAKE_OSX_ARCHITECTURES is '${CMAKE_OSX_ARCHITECTURES}', not empty ''")
|
|
endif()
|
|
add_library(arm64 arm64.c)
|