Skip to content

Crosscompilation support for same CMAKE_SYSTEM_NAME but different CMAKE_SYSTEM_PROCESSOR

Cmake won't succeed building for an arm64 CPU target on an x86_64 CPU host if both the target and the host system name is "Darwin".

This is a common use-case for macOS builds, but affects all crosscompilation targets that are built for the same CMAKE_SYSTEM_NAME.

The issue is that Modules/CMakeDetermineSystem.cmake only detects crosscompilation if CMAKE_SYSTEM_NAME is manually defined.

While this works when the target system name is differs from the host system name (e.g, building for WinCE on a linux host), this solution won't work when building for the same system name and version, but for a different target CPU architecture.

This use-case is especially common on "Darwin" machines, because it's very common to build universal binaries for macOS (binaries that can run on multiple CPU architectures).

Edited by Pavel Ferencz
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information