# Cross compile the same library

**URL:** <https://discourse.cmake.org/t/cross-compile-the-same-library/7309>\
**Category:** Code\
**Created:** [January 23, 2023, 11:01am UTC](https://discourse.cmake.org/t/cross-compile-the-same-library/7309 "2023-01-23T11:01:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samega7Cattac](https://discourse.cmake.org/user_avatar/discourse.cmake.org/samega7cattac/32/3064_2.png) [@Samega7Cattac](https://discourse.cmake.org/u/Samega7Cattac)\
**Post date:** [January 23, 2023, 11:01am UTC](https://discourse.cmake.org/t/cross-compile-the-same-library/7309/1 "2023-01-23T11:01:18Z")

</div>

I’m trying to cross compile my libs with the objective to create a package (just a zip) with with the same lib but in different cpu arch.  
So I want to compile the same target but with a diff compiler to target a diff arch.  
I find it hard to believe that cmake doesn’t support it yet.

---

<div class="post-metadata">

**Author:** ![benthevining](https://discourse.cmake.org/user_avatar/discourse.cmake.org/benthevining/32/1924_2.png) [@benthevining](https://discourse.cmake.org/u/benthevining)\
**Post date:** [January 23, 2023, 5:38pm UTC](https://discourse.cmake.org/t/cross-compile-the-same-library/7309/2 "2023-01-23T17:38:55Z")

</div>

You can do this, but you have to build each arch separately, one-at-a-time. CMake only allows you to use one compiler and target platform at a time per build tree.
