Commit Graph

15 Commits

Author SHA1 Message Date
Jani Heikkinen
994fd04b2b Bump version to 6.4.0
Change-Id: Ie0e2133d6c9125b901364c979c60b6efd585f026
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2022-01-31 17:20:06 +02:00
Alexandru Croitor
99899dd299 Revert "CMake: Warn if cmake_minimum_required has an unsupported low version"
This reverts commit 657525965b.

The change relied on reading the last value of the
CMAKE_MINIMUM_REQUIRED_VERSION variable before one of the Qt packages
is found to use it for the version check.

Even if a user project has a cmake_minimum_required() right at
the beginning of the project with a supported version specified,
the first project() call which loads a CMake toolchain file could
contain another cmake_minimum_required() call with a lower
(unsupported) version and that version would be used for the check,
failing the project configuration.

The Android NDK ships such a toolchain file, which requires version
'3.6'.

Thus, relying on the last value of CMAKE_MINIMUM_REQUIRED_VERSION is
not robust enough.

Pick-to: 6.2
Task-number: QTBUG-95018
Task-number: QTBUG-95832
Change-Id: Iff3cb0a46e6e878569dce9c5fe915a714a034904
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-10-04 15:55:10 +02:00
Alexandru Croitor
657525965b CMake: Warn if cmake_minimum_required has an unsupported low version
Qt6Config.cmake calls cmake_minimum_required to ensure a recent enough
CMake version is used in projects.

That call does not set policies in the calling subdirectory scope,
because find_package introduces a new policy scope.

If a project using Qt has a 'cmake_minimum_required(VERSION 3.1)'
call and is configured with a recent CMake, many policies will
still be set to OLD.

One such policy is CMP0071 (Run AUTOMOC on GENERATED files). The
policy value is queried at generation time rather than at target
definition time, which means we can't influence the policy value
(e.g. inside the implementation of qt_add_executable for example)

The inability to influence the policy value for targets created by our
own CMake functions is unfortunate and can lead to issues (in the case
of the above policy to compilation / linker issues).

Record the version of the last cmake_minimum_required call before
the Qt packages are found and error out if the version is lower than
the minimum supported one.

A project can reduce the error into a warning by specifying a
-DQT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT_IN_CMAKE_MIN_REQUIRED=3.xyz
option when configuring the project.
If the option is used and build issues arise, no official support is
given.

All the CMake example projects shipped with Qt specify a minimum
version of 3.16 already (which is the minimum for shared Qt builds),
so it shouldn't be an issue to require that in other user projects as
well.

Implementation wise, we follow the existing pattern to record
what the minimum and computed versions for static and shared Qt
builds are at qtbase configure time.
These are then checked before the Qt6 or QtFoo packages are
find_package'd.

Amends 6518bcc167

Pick-to: 6.2
Task-number: QTBUG-95018
Task-number: QTBUG-95832
Change-Id: I1a1d06d82f566c92192a699045127943604c8353
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-01 14:32:36 +02:00
Jani Heikkinen
5e84e9fe3a Bump version
Change-Id: Icc0fe22f18dcfd652b79f93644177d45003f9094
2021-09-14 13:19:55 +03:00
Alexandru Croitor
f95a446641 CMake: Bump min required CMake version for static Qt builds to 3.21
Building a static library Qt configuration will now require a
minimum CMake version of 3.21.

Using such a static library Qt configuration in user projects will now
require the same minimum CMake version of 3.21.

Qt builders and packagers can still opt out of the mentioned minimum
required version by configuring Qt with
QT_FORCE_MIN_CMAKE_VERSION_FOR_BUILDING_QT
and
QT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT.

Such a Qt configuration is /NOT SUPPORTED/.

Increase the upper range of CMake policies set to NEW to 3.21.

Amends 9aa0d99e66
Amends 6518bcc167

[ChangeLog][CMake] Building Qt as static libraries now requires
CMake version 3.21 or later. Building user projects with CMake using
that Qt installation also requires a CMake version of 3.21 or later.

Pick-to: 6.2
Fixes: QTBUG-95018
Change-Id: I717b6e1207df46627443b3e5ed430f3c964e2b48
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-08-10 16:51:53 +02:00
Alexandru Croitor
6518bcc167 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>
2021-08-04 16:03:08 +02:00
Alexandru Croitor
9aa0d99e66 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.

Pick-to: 6.2
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>
2021-08-04 16:03:08 +02:00
Alexandru Croitor
42970e490a CMake: Bump min required CMake version for shared Qt builds to 3.16
Building a shared library Qt configuration already required a minimum
CMake version of 3.16, because we depend on CMake's Autogen.json files
which are used for metatype.json file generation.

If a lower version was used, a FATAL_ERROR was issued in
qt6_extract_metatypes.

This change is essentially moving the check to happen earlier in the
qtbase configure process.

User projects will now /also/ officially require a minimum of 3.16
(up from 3.14).

As a consequence, the min/max version policy range that is set in
the public QtFooConfig.cmake files is changed
from 3.14..3.19
to   3.16..3.20

The upper bound is raised because building and using Qt works fine
with all CMake 3.20 policies set to NEW.

[ChangeLog][CMake] Building Qt as shared libraries now requires
CMake version 3.16 or later. Building user projects with CMake using
that Qt installation also requires a CMake version of 3.16 or later.

Pick-to: 6.2
Task-number: QTBUG-95018
Change-Id: I77d2829370f1dfc90b4071bebc8a3ade654e59e6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-07-28 20:54:14 +02:00
Iikka Eklund
08448a5f48 Conan: Read status flag from .cmake.conf
The status information (alpha1, beta2, rc3, ...) needs to be part of
the Conan package reference.

As Conan supports semantic versioning the best place to put the status
is to append it to the version string:

qtbase/6.2.0-alpha1@qt/everywhere
qtbase/6.2.0-beta2@qt/everywhere
qtbase/6.2.0-rc3@qt/everywhere
qtbase/6.2.0@qt/everywhere

Other Conan packages declaring a dependency can use e.g. syntax:

  # notice the asterix character after version
  self.requires(f"qtbase/[<=<version>, include_prerelease=True}]@..)

This way the status information is not in the Conan channel part and
downstream consumers of the Conan package does not need to update
the dependency (Conan reference string) every time the version changes.

Put the status information next to Qt version string in .cmake.cache.

Task-number: QTBUG-94385
Pick-to: 6.2
Change-Id: Ib277f99ea1e87253b93f59e463bd6c7dd8b3203e
Reviewed-by: Toni Saario <toni.saario@qt.io>
2021-06-21 15:19:16 +03:00
Jani Heikkinen
f731802ba8 Bump version
Change-Id: Id34c912da6076994fab38514f66036eb7b787cff
2021-02-18 07:20:21 +02:00
Joerg Bornemann
20a1791157 Lower the CMake minimum required version for single-config builds
Ubuntu 20.04 is a supported platform and comes with CMake 3.16. The
current state of the Qt build works fine with this CMake version, mainly
because the default build on Linux is single-config.

For multi-config builds we have higher version requirements as
documented in cmake/README.md.

This lowers the barrier for users using single-config builds who don't
want or cannot upgrade to CMake >= 3.18.

For Ninja Multi-Config builds, which were introduced by CMake 3.17, we
yield a warning that 3.18.3 is the lowest supported version.

Pick-to: 6.0
Change-Id: Ia918b9f2b494508e86301ffc0e138d3ad4dbaf86
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-01-14 17:00:55 +01:00
Paul Wicking
9a12f7e083 Bump version
CMake edition.
Also update default compiled version.

Task-number: QTQAINFRA-4126
Change-Id: Ia6f535f553e73bd6b00e2e20752f4961af21ede5
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-01-11 13:58:55 +01:00
Craig Scott
3859f15ec9 CMake: Enable NEW policies by CMake version with a global default
When a CMake release introduces a new policy that affects most Qt
modules, it may be appropriate to make each module aware of that newer
CMake version and use the NEW policy without raising the minimum CMake
version requirement. To reduce the churn associated with making that
change across all Qt modules individually, this change allows it to be
updated in a central place (qtbase), but in a way that allows a Qt
module to override it in its own .cmake.conf file if required (e.g. to
address the issues identified by policy warnings at a later time). The
policies are modified at the start of the call to
qt_build_repo_begin().

For commands defined by the qtbase module, qtbase needs to be in
control of the policy settings at the point where those commands are
defined. The above mechanism should not affect the policy settings for
these commands, so the various *Config.cmake.in files must not specify
policy ranges in a way that a Qt module's .cmake.conf file could
influence.

Starting with CMake 3.12, policies can be specified as a version range
with the cmake_minimum_required() and cmake_policy() commands. All
policies introduced in CMake versions up to the upper limit of that
range will be set to NEW. The actual version of CMake being used only
has to be at least the lower limit of the specified version range.
This change uses cmake_minimum_required() rather than cmake_policy()
due to the latter not halting further processing upon failure.
See the following:

    https://gitlab.kitware.com/cmake/cmake/-/issues/21557

Task-number: QTBUG-88700
Pick-to: 6.0
Change-Id: I0a1f2611dd629f847a18186394f500d7f52753bc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-12-07 13:22:57 +11:00
Alexandru Croitor
72aab8b487 CMake: Bump the minimum required CMake version to build Qt to 3.18
Add a new function that returns the minimum CMake version required to
build Qt. Pass that value to cmake_minimum_required() when building
qtbase and its standalone tests.

The minimum supported CMake version is read from qtbase/.cmake.conf
and its value should be updated when the need arises. It's the main
source of truth for all repos.

Provide a way to lower the minimum CMake version at configure time by
passing a value via QT_FORCE_MIN_CMAKE_VERSION.
This is not an officially supported way of building Qt. If the
specified version is lower than Qt's supported minimum, show a
warning.

Nevertheless the option is useful for testing how Qt builds with a
different minimum CMake version due to different policies being
enabled by default.

Issue warnings for CMake versions that are higher than the minimum
version but are known to cause issues when building Qt.

A counterpart change is needed in qt5 to ensure the minimum CMake
version is set at the proper time for top-level builds.

Ideally we would use the same 'check the CMake minimum version` code
in all our repositories, but that will cause lots of duplication because
we can't really find_package() the code and doing something like
include(../qtbase/foo.cmake) hardcodes assumptions about repo
locations.

So for now we don't bump the minimum version in child repo
cmake_minimum_required calls (qtsvg, qtdeclarative, etc).
Instead we record both the minimum supported version and the computed
minimum version (in case a different version was forced) in
QtBuildInternalsExtra.cmake.
Then we require qtbase's computed min version in
qt_build_repo_begin().

This won't set policies as cmake_minimum_required would, but at least
it propagates what minimum CMake version should be used for child
repos.

We might still have to bump the versions in child repos at some point.

Task-number: QTBUG-88086
Change-Id: Ida1c0d5d3e0fbb15d2aee9b68abab7a1648774b9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-11-03 13:06:14 +01:00
Mårten Nordheim
6ffe9b1c42 pro2cmake.py: Generate .cmake.conf files for versioning
And create one for QtBase at the same time.

Fixes: QTBUG-83835
Change-Id: Icc6b022165a57bd4e22c23bdb0016522b99a5b80
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-30 17:44:03 +00:00