diff --git a/cmake/QtBuildInternalsExtra.cmake.in b/cmake/QtBuildInternalsExtra.cmake.in index 2917c2290fd..c035a216f5b 100644 --- a/cmake/QtBuildInternalsExtra.cmake.in +++ b/cmake/QtBuildInternalsExtra.cmake.in @@ -166,6 +166,7 @@ function(qt_internal_force_set_cmake_build_type_conditionally value) AND NOT QT_NO_FORCE_SET_CMAKE_BUILD_TYPE AND NOT __qt_internal_extras_is_multi_config) set(CMAKE_BUILD_TYPE "${value}" CACHE STRING "Choose the type of build." FORCE) + set(__qt_build_internals_cmake_build_type "${value}" PARENT_SCOPE) endif() endfunction() diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake index 98acc11f4e4..112b81c43a4 100644 --- a/cmake/QtSetup.cmake +++ b/cmake/QtSetup.cmake @@ -67,6 +67,7 @@ get_property(QT_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CON # to set the build type when building other repos or tests. if("${CMAKE_BUILD_TYPE}" STREQUAL "${CMAKE_BUILD_TYPE_INIT}" AND NOT __qt_auto_detect_cmake_build_type_before_project_call + AND NOT __qt_build_internals_cmake_build_type AND NOT CMAKE_CONFIGURATION_TYPES) message(STATUS "Setting build type to '${_default_build_type}' as none was specified.") set(CMAKE_BUILD_TYPE "${_default_build_type}" CACHE STRING "Choose the type of build." FORCE)