Fix handling of the DEFINES_DEBUG/DEFINES_RELEASE variables

Modifications of the CONFIG variable in the project file wasn't taken
into account in the handling of DEFINES_DEBUG and DEFINES_RELEASE,
because it was happening before the evaluation of the project file.

Moved the handling code into default_post.prf where the other *_DEBUG
and *_RELEASE variables are handled.

In practice that means: to avoid the addition of the NDEBUG define one
has to remove NDEBUG from DEFINES_RELEASE.

This amends commit 1456b809.

[ChangeLog][qmake] To remove the NDEBUG define that is added by
default in MSVC mkspecs, write DEFINES_RELEASE -= NDEBUG in your .pro
file.

Fixes: QTBUG-81569
Change-Id: I2ea5628653275a4e48ad002977d34969c0663815
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2020-01-22 12:38:53 +01:00
parent 2d57dc2f33
commit 474a5e2f3f
3 changed files with 7 additions and 8 deletions

View File

@ -64,11 +64,13 @@ debug {
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_DEBUG QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_DEBUG
QMAKE_LFLAGS += $$QMAKE_LFLAGS_DEBUG QMAKE_LFLAGS += $$QMAKE_LFLAGS_DEBUG
QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_DEBUG QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_DEBUG
DEFINES += $$DEFINES_DEBUG
} else { } else {
QMAKE_CFLAGS += $$QMAKE_CFLAGS_RELEASE QMAKE_CFLAGS += $$QMAKE_CFLAGS_RELEASE
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_RELEASE QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_RELEASE
QMAKE_LFLAGS += $$QMAKE_LFLAGS_RELEASE QMAKE_LFLAGS += $$QMAKE_LFLAGS_RELEASE
QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_RELEASE QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_RELEASE
DEFINES += $$DEFINES_RELEASE
} }
stack_protector_strong { stack_protector_strong {

View File

@ -26,10 +26,4 @@ CONFIG = \
unset(today) unset(today)
} }
CONFIG(debug, debug|release) {
DEFINES += $$DEFINES_DEBUG
} else {
DEFINES += $$DEFINES_RELEASE
}
load(toolchain) load(toolchain)

View File

@ -1168,7 +1168,7 @@
\section1 DEFINES_DEBUG \section1 DEFINES_DEBUG
Specifies preprocessor defines for the debug configuration. The values of Specifies preprocessor defines for the debug configuration. The values of
this variable get added to \l{DEFINES} before the project is loaded. This this variable get added to \l{DEFINES} after the project is loaded. This
variable is typically set in \l{#QMAKESPEC}{qmake.conf} and rarely needs variable is typically set in \l{#QMAKESPEC}{qmake.conf} and rarely needs
to be modified. to be modified.
@ -1178,10 +1178,13 @@
\section1 DEFINES_RELEASE \section1 DEFINES_RELEASE
Specifies preprocessor defines for the release configuration. The values of Specifies preprocessor defines for the release configuration. The values of
this variable get added to \l{DEFINES} before the project is loaded. This this variable get added to \l{DEFINES} after the project is loaded. This
variable is typically set in \l{#QMAKESPEC}{qmake.conf} and rarely needs variable is typically set in \l{#QMAKESPEC}{qmake.conf} and rarely needs
to be modified. to be modified.
\note For MSVC mkspecs, this variable contains the value \c NDEBUG by
default.
This variable was introduced in Qt 5.13.2. This variable was introduced in Qt 5.13.2.
\target DEF_FILE \target DEF_FILE