Debug options for CMake
In this section:
Choose Project>Options>General Options>Target and select the target device:

On the Library Configuration page in the same options category, select the Library low-level interface implementation to use:

Now the project is ready for debugging using the IAR C-SPY Debugger.