# Building cmake from source for Android

**URL:** https://discourse.cmake.org/t/building-cmake-from-source-for-android/1341
**Category:** Usage
**Tags:** gen:ninja, os:android
**Created:** [June 7, 2020, 8:20am UTC](https://discourse.cmake.org/t/building-cmake-from-source-for-android/1341 "2020-06-07T08:20:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Jacob\_Varghese](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jacob_varghese/32/670_2.png) [@Jacob\_Varghese](https://discourse.cmake.org/u/Jacob_Varghese)
#### Post date: [June 7, 2020, 8:20am UTC](https://discourse.cmake.org/t/building-cmake-from-source-for-android/1341/1 "2020-06-07T08:20:50Z")

</div>

Has anyone tried building cmake for Android? Any issues? I would like to run ctest from within an emulator.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [June 8, 2020, 12:47pm UTC](https://discourse.cmake.org/t/building-cmake-from-source-for-android/1341/2 "2020-06-08T12:47:32Z")

</div>

I think the normal solution here is to cross compile and use [`CMAKE_CROSSCOMPILING_EMULATOR`](https://cmake.org/cmake/help/latest/variable/CMAKE_CROSSCOMPILING_EMULATOR.html) to perform tests on a device over `adb` or the like.

That said, [`termux` has a `cmake` package](https://github.com/termux/termux-packages/tree/master/packages/cmake) for Android you might be able to use (or at least crib instructions for building it to run on Android).

---

<div class="post-metadata">

### Author: ![Jacob\_Varghese](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jacob_varghese/32/670_2.png) [@Jacob\_Varghese](https://discourse.cmake.org/u/Jacob_Varghese)
#### Post date: [June 9, 2020, 5:23am UTC](https://discourse.cmake.org/t/building-cmake-from-source-for-android/1341/3 "2020-06-09T05:23:50Z")

</div>

So I have a very subtle issue here, I’m building on windows, but testing it on a Mac through an adb shell. I’ll take a look at CMAKE\_CROSSCOMPILING\_EMULATOR and may be can get it to work if I play around with the COMMAND option a bit too.

I’m forced to do this because my CICD pipeline doesn’t support running emulators on Windows but I’m trying not to move the building to a Mac.
