From 1456b8091a681316f0e6256554fd138c6399f564 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 12 Sep 2019 10:27:16 +0200 Subject: Make it possible to undefine NDEBUG for nmake and VS projects For nmake and VS projects we added the NDEBUG define for the release configuration unconditionally within the qmake generators. To undefine it, users had to use a nasty work-around. Now, define NDEBUG within the MSVC mkspecs. In order to do that we introduce the DEFINES_RELEASE and DEFINES_DEBUG variables that are merged into DEFINES in default_pre.prf. Users can unset NDEBUG by writing DEFINES -= NDEBUG in their .pro file. Note that DEFINES_RELEASE and DEFINES_DEBUG are merged in default_pre.prf in order to give extra compilers (like moc) the chance to see the fully resolved DEFINES variable. This is different from the QMAKE_CFLAGS_(DEBUG|RELEASE) variables that get merged in default_post.prf. Fixes: QTBUG-78071 Change-Id: I381770a1d2f974fbae9b09a2254e3f2fc7842b68 Reviewed-by: Kai Koehne --- mkspecs/common/msvc-desktop.conf | 1 + mkspecs/common/winrt_winphone/qmake.conf | 1 + mkspecs/features/default_pre.prf | 6 ++++++ 3 files changed, 8 insertions(+) (limited to 'mkspecs') diff --git a/mkspecs/common/msvc-desktop.conf b/mkspecs/common/msvc-desktop.conf index 0b94e5a3f5..034fd3b305 100644 --- a/mkspecs/common/msvc-desktop.conf +++ b/mkspecs/common/msvc-desktop.conf @@ -19,6 +19,7 @@ CONFIG += flat debug_and_release debug_and_release_target precom # MSVC 2017 15.8+ fixed std::aligned_storage but compilation fails without # _ENABLE_EXTENDED_ALIGNED_STORAGE flag since the fix breaks binary compatibility. DEFINES += UNICODE _UNICODE WIN32 _ENABLE_EXTENDED_ALIGNED_STORAGE +DEFINES_RELEASE += NDEBUG QMAKE_COMPILER_DEFINES += _WIN32 contains(QMAKE_TARGET.arch, x86_64) { DEFINES += WIN64 diff --git a/mkspecs/common/winrt_winphone/qmake.conf b/mkspecs/common/winrt_winphone/qmake.conf index 03fb96f2c5..e683018a81 100644 --- a/mkspecs/common/winrt_winphone/qmake.conf +++ b/mkspecs/common/winrt_winphone/qmake.conf @@ -11,6 +11,7 @@ CONFIG = package_manifest $$CONFIG incremental flat precompile_ # MSVC 2017 15.8+ fixed std::aligned_storage but compilation fails without # _ENABLE_EXTENDED_ALIGNED_STORAGE flag since the fix breaks binary compatibility. DEFINES += UNICODE WIN32 QT_LARGEFILE_SUPPORT Q_BYTE_ORDER=Q_LITTLE_ENDIAN _ENABLE_EXTENDED_ALIGNED_STORAGE +DEFINES_RELEASE += NDEBUG QMAKE_COMPILER_DEFINES += _WIN32 DEPLOYMENT_PLUGIN += qwinrt diff --git a/mkspecs/features/default_pre.prf b/mkspecs/features/default_pre.prf index 1c24bf071a..b2629d04c0 100644 --- a/mkspecs/features/default_pre.prf +++ b/mkspecs/features/default_pre.prf @@ -26,4 +26,10 @@ CONFIG = \ unset(today) } +CONFIG(debug, debug|release) { + DEFINES += $$DEFINES_DEBUG +} else { + DEFINES += $$DEFINES_RELEASE +} + load(toolchain) -- cgit v1.2.3