# Confused with Toolchain and CMAKE\_SYSTEM\_PROCESSOR and CMP0123

**URL:** <https://discourse.cmake.org/t/confused-with-toolchain-and-cmake-system-processor-and-cmp0123/9966>\
**Category:** Code\
**Created:** [January 30, 2024, 12:11pm UTC](https://discourse.cmake.org/t/confused-with-toolchain-and-cmake-system-processor-and-cmp0123/9966 "2024-01-30T12:11:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pedahl](https://discourse.cmake.org/user_avatar/discourse.cmake.org/pedahl/32/3307_2.png) [@pedahl](https://discourse.cmake.org/u/pedahl)\
**Post date:** [January 30, 2024, 12:11pm UTC](https://discourse.cmake.org/t/confused-with-toolchain-and-cmake-system-processor-and-cmp0123/9966/1 "2024-01-30T12:11:03Z")

</div>

Hi,  
i’m a little bit confused about set CMAKE\_SYSTEM\_PROCESSOR and the policy CMP0123 according to a Toolchainfile.  
I want to build a cmake project for a bare metal system and i want to compile it with armclang.  
I created a Toolchain File:  
Snippet

```cmake
set(CMAKE_SYSTEM_NAME Generic) 
set(CMAKE_SYSTEM_VERSION "6") 
set(COMPILER_PATH C:/Keil_v5/ARM/ARMCLANG) 
find_program(ARM_CC NAMES armclang PATHS ${COMPILER_PATH}/bin REQUIRED NO_DEFAULT_PATH) 
find_program(ARM_CXX NAMES armclang PATHS ${COMPILER_PATH}/bin REQUIRED NO_DEFAULT_PATH) 
find_program(ARM_ASM NAMES armasm PATHS ${COMPILER_PATH}/bin REQUIRED NO_DEFAULT_PATH) 
find_program(ARM_AR NAMES armar PATHS ${COMPILER_PATH}/bin REQUIRED NO_DEFAULT_PATH) 
find_program(ARM_LINK NAMES armlink PATHS ${COMPILER_PATH}/bin REQUIRED NO_DEFAULT_PATH) 
find_program(ARM_FROMELF NAMES fromelf PATHS ${COMPILER_PATH}/bin REQUIRED NO_DEFAULT_PATH) 
set(CMAKE_C_COMPILER ${ARM_CC} CACHE STRING "") 
set(CMAKE_CXX_COMPILER ${ARM_CXX} CACHE STRING "") 
set(CMAKE_ASM_COMPILER ${ARM_ASM} CACHE STRING "") 
set(CMAKE_LINKER ${ARM_LINK} CACHE STRING "") set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 
set(CMAKE_FIND_ROOT_PATH ${COMPILER_PATH}) 
set(CMAKE_SYSROOT ${COMPILER_PATH})

```

According to CMP0123 i have inserted in the CMakeLists.txt

```cmake
set(CMAKE_SYSTEM_PROCESSOR cortex-m4)
set(CMAKE_SYSTEM_ARCH armv7e-m)

```

but CMake give me the error that the CMAKE\_SYSTEM\_PROCESSOR and CMAKE\_SYSTEM\_ARCH are unset…  
How can i set it correctly?

Bests  
Brian

---

<div class="post-metadata">

**Author:** ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)\
**Post date:** [January 30, 2024, 8:56pm UTC](https://discourse.cmake.org/t/confused-with-toolchain-and-cmake-system-processor-and-cmp0123/9966/2 "2024-01-30T20:56:08Z")

</div>

Those two variables should also be in the toolchain file.

---

<div class="post-metadata">

**Author:** ![pedahl](https://discourse.cmake.org/user_avatar/discourse.cmake.org/pedahl/32/3307_2.png) [@pedahl](https://discourse.cmake.org/u/pedahl)\
**Post date:** [January 31, 2024, 8:48am UTC](https://discourse.cmake.org/t/confused-with-toolchain-and-cmake-system-processor-and-cmp0123/9966/3 "2024-01-31T08:48:21Z")

</div>

Thanks…  
I missunderstood the warning…  
I have to call

`cmake_policy(SET CMP0123 NEW)`

No the warning is gone…
