diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-08-02 18:39:07 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-08-03 16:04:38 +0000 |
commit | c711bf3158bcb0a0975729cdc621d6c9f22dc9b7 (patch) | |
tree | bcaed75ad0d6c87e20dca2667fe54bec7b1d1065 | |
parent | 833d6cdb309f360e1d1e97808d4db289d98cef75 (diff) |
CMake: Relax constraint on not having feature values change
Previously if qtbase was built with feature A set to ON, then building
qtsvg, then rebuilding qtbase with feature A set to OFF, trying to
build qtsvg would fail with an error message at configure time saying
that the feature value has changed.
This check was added quite early in the Qt CMake port, presumably to
catch accidental reconfigures that might cause long rebuilds.
This has dubious benefit though. We constantly had people telling us
they get the error without knowing what to do. The usual advice was to
remove CMakeCache.txt and reconfigure.
Instead of forcing people to suffer this dance, relax the constraint
by issuing a warning instead of an error, and make it more clear why
a rebuild might happen (a changed feature value might change
the generated module C++ header file which in turn might be included
by various project sources).
Amends 20633d97abed0f6025572f87c9359272b4713384
Fixes: QTBUG-95834
Change-Id: I992bd61024958869f3b995471b4c7ff75e3a33a0
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 15117f84bb9a5fd191105b2a4d8ebafc6c819fb9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | cmake/QtFeature.cmake | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake index b9af639503..54222b6696 100644 --- a/cmake/QtFeature.cmake +++ b/cmake/QtFeature.cmake @@ -1246,7 +1246,15 @@ function(qt_make_features_available target) endif() foreach(feature IN ITEMS ${features}) if (DEFINED "QT_FEATURE_${feature}" AND NOT "${QT_FEATURE_${feature}}" STREQUAL "${value}") - message(FATAL_ERROR "Feature ${feature} is already defined to be \"${QT_FEATURE_${feature}}\" and should now be set to \"${value}\" when importing features from ${target}.") + message(WARNING + "This project was initially configured with the Qt feature \"${feature}\" " + "set to \"${QT_FEATURE_${feature}}\". While loading the " + "\"${target}\" package, the value of the feature " + "has changed to \"${value}\". That might cause a project rebuild due to " + "updated C++ headers. \n" + "In case of build issues, consider removing the CMakeCache.txt file and " + "reconfiguring the project." + ) endif() set(QT_FEATURE_${feature} "${value}" CACHE INTERNAL "Qt feature: ${feature} (from target ${target})") endforeach() |