iarsystems / cmake-tutorial

Build and test embedded software using the IAR C/C++ Compiler alongside CMake
https://iar.com
MIT License
76 stars 14 forks source link

CMake overwrites CMAKE_SYSTEM_PROCESSOR when not explicitly cross-compiling #20

Closed jofa-ph closed 1 year ago

jofa-ph commented 1 year ago

CMake overwrites CMAKE_SYSTEM_PROCESSOR which is set in iar-toolchain.cmake with detected PC architecture (e.g. AMD64). Therefore, the CSpy tests created using the function iar_cspy_add_test defined in iar-cspy-rl78.cmake fail. This is, because file names are created using the overwritten variable.

To fix this, CMAKE_SYSTEM_NAME should be set to Generic in the toolchain file. This keeps CMake from automatically detecting and overwriting CMAKE_SYSTEM_PROCESSOR.

felipe-iar commented 1 year ago

Thanks for reporting this bug, Jonas. We will get it fixed soon.