QMake forcibly disables assertions with no way to re-enable them when doing release builds on windows with visual studio. This is unexpectedly different from other platforms, and causes problems with debugging optimized applications on this platform.
I have attached a sample program that demonstrates the problem. It is simply a default project from QtCreator with an assertion added before the main window opens. On Linux this behaves as expected (the assertion is triggered), but on Windows the assertion is skipped.
Steps to reproduce:
in the directory of the attached project run "mkdir build && cd build && qmake .. && nmake && release\AssertionTest.exe"
The application should exit with an assertion before showing a window.
The application executes successfully.
This can be worked around by adding the following line in the project file:
DEFINES += NDEBUG "FIX_NDEBUG -UNDEBUG"
This is a bit of an abuse of qmake's parsing though, and adds an extra define that we don't really care about.