From 6a859f8112e33c1373b6b6899475ee79b3ba3137 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 23 Aug 2019 10:41:17 +0200 Subject: CMake: Fix usage of non debug and release static builds on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 44602224bfae7bea08e5883768cfeef6629ac503. Change-Id: I42be684e8ad2a5ce72cb2e9d36f81de7589112c6 Reviewed-by: Jörg Bornemann --- mkspecs/features/create_cmake.prf | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'mkspecs') diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf index 8100128441..5c561042cd 100644 --- a/mkspecs/features/create_cmake.prf +++ b/mkspecs/features/create_cmake.prf @@ -153,7 +153,14 @@ if(debug_and_release:build_all)|CONFIG(release, debug|release): CMAKE_RELEASE_TY # 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 -- cgit v1.2.3