Fix missed feature evaluation errors in report

Add an optional argument to store the report command while feature
evaluation-only stage. This is necessary, because according to the
actual feature evaluation process, evaluation happens only once and it's
impossible to record any command during the evaluation-only stage.

Fixes: QTBUG-90319
Change-Id: I215fbe0a28a2661cd2d97d253b2e2c787d295cbd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
This commit is contained in:
Alexey Edelev 2021-01-14 18:28:57 +01:00
parent 154573929a
commit 8d76903b97
2 changed files with 10 additions and 4 deletions

View File

@ -76,9 +76,15 @@ endfunction()
# Takes a list of arguments, and saves them to be evaluated at the end of the configuration # Takes a list of arguments, and saves them to be evaluated at the end of the configuration
# phase when the configuration summary is shown. # phase when the configuration summary is shown.
#
# RECORD_ON_FEATURE_EVALUATION option allows to record the command even while the feature
# evaluation-only stage.
function(qt_configure_record_command) function(qt_configure_record_command)
cmake_parse_arguments(arg "RECORD_ON_FEATURE_EVALUATION"
""
"" ${ARGV})
# Don't record commands when only evaluating features of a configure.cmake file. # Don't record commands when only evaluating features of a configure.cmake file.
if(__QtFeature_only_evaluate_features) if(__QtFeature_only_evaluate_features AND NOT arg_RECORD_ON_FEATURE_EVALUATION)
return() return()
endif() endif()
@ -88,7 +94,7 @@ function(qt_configure_record_command)
set(command_count 0) set(command_count 0)
endif() endif()
set_property(GLOBAL PROPERTY qt_configure_command_${command_count} "${ARGV}") set_property(GLOBAL PROPERTY qt_configure_command_${command_count} "${arg_UNPARSED_ARGUMENTS}")
math(EXPR command_count "${command_count}+1") math(EXPR command_count "${command_count}+1")
set_property(GLOBAL PROPERTY qt_configure_command_count "${command_count}") set_property(GLOBAL PROPERTY qt_configure_command_count "${command_count}")
@ -365,7 +371,7 @@ endfunction()
function(qt_configure_add_report_error error) function(qt_configure_add_report_error error)
message(SEND_ERROR "${error}") message(SEND_ERROR "${error}")
qt_configure_add_report_entry(TYPE ERROR MESSAGE "${error}" CONDITION TRUE) qt_configure_add_report_entry(TYPE ERROR MESSAGE "${error}" CONDITION TRUE ${ARGN})
endfunction() endfunction()
function(qt_configure_process_add_report_entry) function(qt_configure_process_add_report_entry)

View File

@ -275,7 +275,7 @@ macro(qt_feature_set_value feature cache condition label conditionExpression)
_qt_internal_dump_expression_values(conditionDump "${conditionExpression}") _qt_internal_dump_expression_values(conditionDump "${conditionExpression}")
string(JOIN " " conditionString ${conditionExpression}) string(JOIN " " conditionString ${conditionExpression})
qt_configure_add_report_error("Feature \"${feature}\": Forcing to \"${cache}\" breaks its \ qt_configure_add_report_error("Feature \"${feature}\": Forcing to \"${cache}\" breaks its \
condition:\n ${conditionString}\nCondition values dump:\n ${conditionDump}\n") condition:\n ${conditionString}\nCondition values dump:\n ${conditionDump}\n" RECORD_ON_FEATURE_EVALUATION)
endif() endif()
if (DEFINED "QT_FEATURE_${feature}") if (DEFINED "QT_FEATURE_${feature}")