CMake: Fix usage of non debug and release static builds on Windows

As was recently discovered, the debug_and_release CONFIG value is
always true on Windows, even if the feaure is disabled when specifying
-debug or -release when configuring Qt.

In order for the generated CMake Config files to be correct, we need
to use the true feature value.

Amends 44602224bf.

Change-Id: I42be684e8ad2a5ce72cb2e9d36f81de7589112c6
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2019-08-23 10:41:17 +02:00
parent 7cbe1ca33d
commit 6a859f8112

View File

@ -153,7 +153,14 @@ if(debug_and_release:build_all)|CONFIG(release, debug|release): CMAKE_RELEASE_TY
# <CONFIG> equivalent to the value specified by CMAKE_BUILD_TYPE.
# This means that when Qt was built in a Release configuration, and the application in a Debug
# configuration, IMPORTED_LOCATION_RELEASE will be used for the Qt libraries.
debug_and_release {
#
# Note that we need to check for the "debug_and_release" feature, and not the CONFIG value, because
# the CONFIG value is always set to true on Windows in msvc-desktop.conf disregarding whether the
# configure line specified just -debug or just -release.
# This also means that if a user configures and builds Qt with -release, and then calls nmake debug
# to build debug libraries of Qt, the generated CMake file won't know about debug libraries,
# and will always link against the release libraries.
qtConfig(debug_and_release) {
CMAKE_DEBUG_AND_RELEASE = TRUE
} else {
CMAKE_DEBUG_AND_RELEASE = FALSE