How to enable C / C++ asserts?

Hi,

normally, I would set the CMAKE_BUILD_TYPE to `Debug` to enable Cs "assert" function (not define NDEBUG). Zephyr (and Nordic-Zephyr as well) has the `CONFIG_ASSERT` configuration option but this seems to only enable Zephyrs asserts. How am I'm supposed to enable C asserts (aka how to _not_ define NDEBUG)?

best regards

Torsten

Parents Reply
  • Hi Jakob,

    I stumbled over this, by observing asserts, that I thought should fire, but did not. I added an `assert(false)` to my application code and it did not fire. I added

    #ifdef NDEBUG
    #undef NDEBUG
    #endif
    
    #include <cassert>
    

    to the file in question and finally, `assert( false )` fired.

    I have not found anything in my CMakeLists.txt that would add NDEBUG to the set of defines.

    best regards

    Torsten

Children
No Data
Related