summaryrefslogtreecommitdiffstats
path: root/.cmake.conf
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-07-22 16:23:51 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2021-08-04 16:03:08 +0200
commit6518bcc167d47e1c27d082c21551b9a838b04e5d (patch)
tree4faa5bcfb7f33fd0980b8dbbdb2e96a2d5802cb5 /.cmake.conf
parent9aa0d99e66b8be2be75d4f3b7fce2b94db9a1e32 (diff)
CMake: Enforce minimum CMake version in user projects
This change introduces new behavior to error out when configuring user projects if the CMake version used is too old for Qt to work with. The main motivator is the requirement of new CMake features to ensure object libraries are placed in the proper place on the link line in static builds. The minimum CMake version is computed based on whether Qt was configured as shared or static libraries. At the moment the required versions for building and using Qt are the same. The minimum versions are defined in qtbase/.cmake.conf in the following variables QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_QT_SHARED QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_QT_STATIC QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_SHARED QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_STATIC Qt Packagers can disable the version check when configuring Qt by setting QT_FORCE_MIN_CMAKE_VERSION_FOR_BUILDING_QT and QT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT. In this case it is the packagers responsibility to ensure such a Qt works correctly with the specified CMake version. User projects can also set QT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT to disable the version check. Then it's the project's developer responsibility to ensure such a Qt works correctly. No official support is provided for these cases. Implementation notes. The versions required to build Qt are stored in QtBuildInternalsExtra.cmake whereas the versions required to use Qt are stored in a new QtConfigExtras.cmake. Also the policy range variables stored in QtBuildInternalsExtra.cmake are now regular variables instead of cache variables, to properly allow overrides per-repository. Some renaming of functions and variables was done for a bit more clarity and easier grep-ability. Pick-to: 6.2 Task-number: QTBUG-95018 Change-Id: I4279f2e10b6d3977319237ba21e2f4ed676aa48b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to '.cmake.conf')
-rw-r--r--.cmake.conf10
1 files changed, 8 insertions, 2 deletions
diff --git a/.cmake.conf b/.cmake.conf
index ff95a9c186..12991eebd5 100644
--- a/.cmake.conf
+++ b/.cmake.conf
@@ -2,8 +2,14 @@ set(QT_REPO_MODULE_VERSION "6.2.0")
set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1")
# Minimum requirement for building Qt
-set(QT_MIN_SUPPORTED_CMAKE_VERSION "3.16")
-set(QT_MIN_SUPPORTED_CMAKE_VERSION_FOR_STATIC_QT "3.20")
+set(QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_QT_SHARED "3.16")
+set(QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_QT_STATIC "3.20")
+
+# Minimum requirement for consuming Qt in a user project.
+# This might be different in the future, e.g. be lower than the requirement for
+# building Qt.
+set(QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_SHARED "3.16")
+set(QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_STATIC "3.20")
# Policy settings for commands defined by qtbase. These will also be injected
# into the top level policy scope of each Qt module when building Qt so that