diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-07-06 17:55:30 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-08-04 23:10:18 +0000 |
commit | f44e9db471ff2ee8127a44dd26d8fcdcc49ab4e6 (patch) | |
tree | 159c190864d29bfa0e8230d91e83ac4ef3bac7c7 /CMakeLists.txt | |
parent | 91db96f3366cb5ebe5846ac69b593acc4830d2c9 (diff) |
CMake: Bump min required CMake version for static Qt builds to 3.20
Building a static library Qt configuration will now require a
minimum CMake version of 3.20.
Qt builders and packagers can still opt out of the mentioned minimum
required version by configuring Qt with QT_FORCE_MIN_CMAKE_VERSION.
Such a Qt configuration is /NOT SUPPORTED/.
To facilitate these changes, the minimum version check has been moved
to happen after the BUILD_SHARED_LIBS option is computed by either
QtAutoDetect.cmake or set by a user provided cmake toolchain file.
Introduce a new QT_MIN_SUPPORTED_CMAKE_VERSION_FOR_STATIC_QT variable
in .cmake.conf to mark the minimum version for a static Qt build.
Task-number: QTBUG-95018
Change-Id: Idc1875729f26a7c635b6bd26ac0c1be973917c13
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
(cherry picked from commit 9aa0d99e66b8be2be75d4f3b7fce2b94db9a1e32)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 35ee14102e..c3dcc2f731 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,10 +28,6 @@ endif() unset(build_dir_absolute) unset(build_dir_realpath) -# Early check to reduce chance of warning being lost in the output -include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/QtCMakeVersionHelpers.cmake") -qt_internal_check_for_suitable_cmake_version() - # Run auto detection routines, but not when doing standalone tests. In that case, the detection # results are taken from either QtBuildInternals or the qt.toolchain.cmake file. Also, inhibit # auto-detection in a top-level build, because the top-level project file already includes it. @@ -39,6 +35,7 @@ if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_SUPERBUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/QtAutoDetect.cmake) endif() +# This call will load any provided cmake toolchain file. project(QtBase VERSION "${QT_REPO_MODULE_VERSION}" DESCRIPTION "Qt Base Libraries" @@ -46,6 +43,22 @@ project(QtBase LANGUAGES CXX C ASM ) +# Should this Qt be static or dynamically linked? +option(BUILD_SHARED_LIBS "Build Qt statically or dynamically" ON) +set(QT_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) + +# This variable is also set in Qt6CoreConfigExtras.cmake, but it's not loaded when building +# qtbase. Set it here so qt_add_plugin can compute the proper plugin flavor. +set(QT6_IS_SHARED_LIBS_BUILD ${BUILD_SHARED_LIBS}) + +# BUILD_SHARED_LIBS influences the minimum required CMake version. The value is set either by: +# a cache variable provided on the configure command line +# or set by QtAutoDetect.cmake depending on the platform +# or specified via a toolchain file that is loaded by the project() call +# or set by the option() call above +include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/QtCMakeVersionHelpers.cmake") +qt_internal_check_for_suitable_cmake_version() + if(NOT QT_BUILD_STANDALONE_TESTS) ## Add some paths to check for cmake modules: list(PREPEND CMAKE_MODULE_PATH @@ -77,14 +90,6 @@ endif() qt_build_repo_begin() if(NOT QT_BUILD_STANDALONE_TESTS) - ## Should this Qt be static or dynamically linked? - option(BUILD_SHARED_LIBS "Build Qt statically or dynamically" ON) - set(QT_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) - - # This variable is also set in Qt6CoreConfigExtras.cmake, but it's not loaded when building - # qtbase. Set it here so qt_add_plugin can compute the proper plugin flavor. - set(QT6_IS_SHARED_LIBS_BUILD ${BUILD_SHARED_LIBS}) - ## Should this Qt be built with Werror? option(WARNINGS_ARE_ERRORS "Build Qt with warnings as errors" ${FEATURE_developer_build}) |