# Cross Compiling toolchain not taken into account

**URL:** https://discourse.cmake.org/t/cross-compiling-toolchain-not-taken-into-account/1901
**Category:** Usage
**Created:** [September 23, 2020, 1:26pm UTC](https://discourse.cmake.org/t/cross-compiling-toolchain-not-taken-into-account/1901 "2020-09-23T13:26:20Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![SadE](https://discourse.cmake.org/user_avatar/discourse.cmake.org/sade/32/848_2.png) [@SadE](https://discourse.cmake.org/u/SadE)
#### Post date: [September 23, 2020, 1:26pm UTC](https://discourse.cmake.org/t/cross-compiling-toolchain-not-taken-into-account/1901/1 "2020-09-23T13:26:20Z")

</div>

Hi,

I’m new to CMAke and trying to set up a cross compile project for ARM using the Armcc tools (from Keil) . I saw the toolchain files are part of the Cmake distribution , so I’m trying to use it … without any success. I set up a simple test project with this CMakeLists.txt :  
cmake\_minimum\_required(VERSION 3.10)  
project(Tutorial)  
# add the executable  
add\_executable(test.c)

When I launch:  
cmake D:\Tmp\Test -D CMAKE\_TOOLCHAIN\_FILE=“D:\Dev\CMake\share\cmake-3.18\Modules\Compiler\ARMCC.cmake” -D CMAKE\_C\_COMPILER\_ID=ARMCC -D CMAKE\_CXX\_COMPILER\_ID=ARMCC -GNinja

It’s seems it’s not using the compiler defined in the toolchain but trying to use gcc installed on my desktop.

So I’m not sure to understand how to use the provided compilers from the armcc toolchain ?

---

<div class="post-metadata">

### Author: ![snikulov](https://discourse.cmake.org/user_avatar/discourse.cmake.org/snikulov/32/194_2.png) [@snikulov](https://discourse.cmake.org/u/snikulov)
#### Post date: [September 23, 2020, 1:48pm UTC](https://discourse.cmake.org/t/cross-compiling-toolchain-not-taken-into-account/1901/2 "2020-09-23T13:48:57Z")

</div>

Hi,

It’s because Modules\Compiler\ARMCC.cmake is not a toolchain file.

Have you got a chance to look into [documentation](https://cmake.org/cmake/help/v3.6/manual/cmake-toolchains.7.html)?

Another example can be found [here](https://github.com/vpetrigo/arm-cmake-toolchains).

---

<div class="post-metadata">

### Author: ![SadE](https://discourse.cmake.org/user_avatar/discourse.cmake.org/sade/32/848_2.png) [@SadE](https://discourse.cmake.org/u/SadE)
#### Post date: [September 23, 2020, 2:04pm UTC](https://discourse.cmake.org/t/cross-compiling-toolchain-not-taken-into-account/1901/3 "2020-09-23T14:04:46Z")

</div>

Ok, thx  
But then, what are the armcc\*.cmake files for ?

---

<div class="post-metadata">

### Author: ![fdk17](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/f/ea666f/32.png) [@fdk17](https://discourse.cmake.org/u/fdk17)
#### Post date: [September 23, 2020, 3:18pm UTC](https://discourse.cmake.org/t/cross-compiling-toolchain-not-taken-into-account/1901/4 "2020-09-23T15:18:28Z")

</div>

From cmake-toolchains(7):  
In normal builds, CMake automatically determines the toolchain for host builds based on system introspection and defaults. In cross-compiling scenarios, a toolchain file may be specified with information about compiler and utility paths.

What you are looking at are files that support compilers / toolchains that CMake already knows how to use. As already mentioned they are not toolchain files as used by `CMAKE_TOOLCHAIN_FILE`.
