# How to cross compile from linux to all desktop OSes and architectures

**URL:** https://discourse.cmake.org/t/how-to-cross-compile-from-linux-to-all-desktop-oses-and-architectures/13191
**Category:** Usage
**Tags:** os:linux, os:windows, os:macos
**Created:** [December 12, 2024, 8:46pm UTC](https://discourse.cmake.org/t/how-to-cross-compile-from-linux-to-all-desktop-oses-and-architectures/13191 "2024-12-12T20:46:21Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Paradox84](https://discourse.cmake.org/user_avatar/discourse.cmake.org/paradox84/32/5131_2.png) [@Paradox84](https://discourse.cmake.org/u/Paradox84)
#### Post date: [December 12, 2024, 8:46pm UTC](https://discourse.cmake.org/t/how-to-cross-compile-from-linux-to-all-desktop-oses-and-architectures/13191/1 "2024-12-12T20:46:21Z")

</div>

I’m trying to cross compile from github actions for all the desktop OSes and architectures. Github actions part is only relevant to always starting from a fresh install of ubuntu 24.04

Host is always ubuntu 24.04 x86\_64, targets are following  
1-) linux x86\_64  
2-) linux aarch64  
3-) windows x86\_64  
4-) windows aarch64  
5-) mac x86\_64  
6-) mac aarch64

I tried bunch of ways, but always ended up compiling for a single architecture. What is the correct way of doing cross compile?  
I suspect I’m missing tools to perform cross compile, so CMake silently does the wrong thing.

My commands are following:  
1-) cmake -B build/ -DCMAKE\_BUILD\_TYPE=Release -DCMAKE\_SYSTEM\_PROCESSOR=TARGET\_ARCHITECTURE  
2-) cmake --build build/ --config Release
