path: root/cmake/
diff options
authorJoerg Bornemann <>2022-01-19 13:13:12 +0100
committerAlexandru Croitor <>2022-01-21 14:24:09 +0100
commit33af62db3747bb6fcb7490ef2d2abc5bb53925b6 (patch)
tree9c6711f7a7d0c18660601dd74e0d47f62d9f6f28 /cmake/
parent0d5dc56554988edb87cb1575220a107c8a1f9cc4 (diff)
CMake: Support overriding CMAKE_BUILD_TYPE per-repo or test
One might want to build qtbase in Release, but qtsvg or some test in Debug mode. Before if qtbase was configured as Release, there was no way to override that. Now we try to detect whether a custom build type was specified to qt-cmake / qt-configure-module / qt-cmake-standalone-test / qt-internal-configure-tests Note mixing won't work on Windows due to different C/C++ runtimes. Also, now we don't force set a single build type when a multi config generator is used as well as one opts out via the QT_NO_FORCE_SET_CMAKE_BUILD_TYPE variable. Pick-to: 6.2 6.3 Change-Id: I6dc4325087ff7f905ad677d87b0267e2f3e4693f Reviewed-by: Qt CI Bot <> Reviewed-by: Joerg Bornemann <>
Diffstat (limited to 'cmake/')
1 files changed, 6 insertions, 0 deletions
diff --git a/cmake/ b/cmake/
index b8c5852dff..23f322824d 100644
--- a/cmake/
+++ b/cmake/
@@ -202,6 +202,12 @@ if(__qt_toolchain_host_path_required AND
"the location of your host Qt installation lib/cmake directory.")
+# Store initial build type (if any is specified) to be read by QtBuildInternals.cmake when building
+# a Qt repo, standalone tests or a single test.
+ set(__qt_toolchain_cmake_build_type_before_project_call "${CMAKE_BUILD_TYPE}")
# Compile tests only see a restricted set of variables.
# All cache variables, this toolchain file uses, must be made available to project-based
# try_compile tests because this toolchain file will be included there too.