CMake: Fix reconfiguration error when features have EMIT_IF conditions
Previously, if a feature was marked as not to be emitted and there was
no user provided value for that feature, the build system would still
save the user provided value in FEATURE_foo with a value of ON (if the
conditions were met).
After a reconfiguration, the build system would hit the code path that
checks if the user provided a value for the non-emitted feature, and
would then warn about it and reset the feature value to OFF.
This would cause errors when reconfiguring a user project, complaining
that a feature value has changed.
Make sure to not save the user provided value for a non-emitted
feature and to always set its internal feature value to OFF.
Amends c4f5762b20
Pick-to: 6.2
Fixes: QTBUG-94921
Change-Id: I257c7fd795c8a6aeba3348cb72522e4f0b006dc9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
bb10
parent
cde126ef26
commit
451733bd57
|
|
@ -374,18 +374,27 @@ function(qt_evaluate_feature feature)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# Warn about a feature which is not emitted, but the user explicitly provided a value for it.
|
||||
if(NOT emit_if AND DEFINED FEATURE_${feature})
|
||||
set(msg "")
|
||||
string(APPEND msg
|
||||
"Feature ${feature} is insignificant in this configuration, "
|
||||
"ignoring related command line option(s).")
|
||||
qt_configure_add_report_entry(TYPE WARNING MESSAGE "${msg}")
|
||||
set(computed OFF)
|
||||
set(FEATURE_${feature} OFF)
|
||||
|
||||
# Remove the cache entry so that the warning is not persisted and shown on every
|
||||
# reconfiguration.
|
||||
unset(FEATURE_${feature} CACHE)
|
||||
endif()
|
||||
|
||||
qt_feature_check_and_save_user_provided_value(
|
||||
saved_user_value "${feature}" "${condition}" "${computed}" "${arg_LABEL}")
|
||||
# Only save the user provided value if the feature was emitted.
|
||||
if(emit_if)
|
||||
qt_feature_check_and_save_user_provided_value(
|
||||
saved_user_value "${feature}" "${condition}" "${computed}" "${arg_LABEL}")
|
||||
else()
|
||||
# Make sure the feature internal value is OFF if not emitted.
|
||||
set(saved_user_value OFF)
|
||||
endif()
|
||||
|
||||
qt_feature_check_and_save_internal_value(
|
||||
"${feature}" "${saved_user_value}" "${condition}" "${arg_LABEL}" "${arg_CONDITION}")
|
||||
|
|
|
|||
Loading…
Reference in New Issue