Aha, ok then.
It seems it has something together with build profiles. So so it should change depending on the selected profile
- Detect Build Profile in code - Mbed OS / Best practice - Arm Mbed OS support forum
- mbed-os/tools/cmake/profiles/release.cmake at baf6a3022a328b91713e03fd88f65126a9a53f01 · ARMmbed/mbed-os · GitHub
- Set macro NDEBUG for release builds · Issue #347 · ARMmbed/mbed-cli (github.com)
BR, Jan