CMake: Warn when using CMake 3.20.1 due to crashes in AUTOMOC

With CMake 3.20.1 AUTOMOC can crash or hang on Windows when used with
a Qt installation that supports moc depfiles due to missing
multi-threaded locking.
Warn and advise to use a different CMake version instead.

Change-Id: I78d2269c48dfc2541bebcd6ab23aaa5595012149
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit aab8a0ac6e5365d97d3c7571b26430776b7b5f49)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexandru Croitor 2021-04-16 12:20:52 +02:00 committed by Qt Cherry-pick Bot
parent 3159753358
commit 19b70c1caa

View File

@ -121,6 +121,12 @@ function(qt_internal_warn_about_unsuitable_cmake_versions)
# https://gitlab.kitware.com/cmake/cmake/-/issues/21977
list(APPEND unsuitable_versions "3.20.0")
# AUTOMOC can crash or hang when using a Qt that supports moc depfiles.
# Issues reported on Windows with Ninja and Makefiles, but it could be happening
# on other platforms too.
# https://gitlab.kitware.com/cmake/cmake/-/issues/22014
list(APPEND unsuitable_versions "3.20.1")
foreach(unsuitable_version ${unsuitable_versions})
if(CMAKE_VERSION VERSION_EQUAL unsuitable_version)
message(WARNING