Debug options for CMake
In this section:
Choose Project>Options>General Options>Target and make sure that all options reflect the options you have set in CMake for the project.
On the Library Configuration page in the same options category, select these options:
Option
Setting
Library low-level interface implementation
Semihosted
stdout/stderr
Via semihosting
Now the project is ready for debugging using the IAR C-SPY Debugger.