summaryrefslogtreecommitdiffstats
path: root/cmake/QtAutoDetect.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-11-10 15:00:13 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-11-10 16:53:31 +0100
commita3b9e3459f02d23c66b2a7fa5e2ea6fac03bbe82 (patch)
treed0b135186f82c1d6d333e14c85982ef125e28a03 /cmake/QtAutoDetect.cmake
parentfbf11e86efc9b775e347066ff9520ae5b476f13d (diff)
CMake: Warn when building Qt with a generator other than Ninja
For now, we only support building Qt with the Ninja generator (and Ninja Multi-Config). Issue a warning when a different generator is used. Allow opting out of the warning by passing -DQT_SILENCE_CMAKE_GENERATOR_WARNING=ON. Change-Id: I5faa5b0ca5fd42efc090ad2ccf4f896bd77e50ca Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake/QtAutoDetect.cmake')
-rw-r--r--cmake/QtAutoDetect.cmake10
1 files changed, 10 insertions, 0 deletions
diff --git a/cmake/QtAutoDetect.cmake b/cmake/QtAutoDetect.cmake
index 33ecef4a65..4518078d8d 100644
--- a/cmake/QtAutoDetect.cmake
+++ b/cmake/QtAutoDetect.cmake
@@ -5,6 +5,15 @@
# Make sure to not run detection when building standalone tests, because the detection was already
# done when initially configuring qtbase.
+function(qt_auto_detect_cmake_generator)
+ if(NOT CMAKE_GENERATOR MATCHES "Ninja" AND NOT QT_SILENCE_CMAKE_GENERATOR_WARNING)
+ message(WARNING
+ "The officially supported CMake generator for building Qt is Ninja. "
+ "You are using: '${CMAKE_GENERATOR}' instead. "
+ "Thus, you might encounter issues. Use at your own risk.")
+ endif()
+endfunction()
+
function(qt_auto_detect_android)
# Auto-detect NDK root
if(NOT DEFINED CMAKE_ANDROID_NDK_ROOT AND DEFINED ANDROID_SDK_ROOT)
@@ -294,6 +303,7 @@ function(qt_auto_detect_pch)
option(BUILD_WITH_PCH "Build Qt using precompiled headers?" "${default_value}")
endfunction()
+qt_auto_detect_cmake_generator()
qt_auto_detect_cyclic_toolchain()
qt_auto_detect_cmake_config()
qt_auto_detect_darwin()