configure: translate inputs matching feature names to FEATURE_foo

Inputs (in the sense of configure commandline options) are now
translated to -DFEATURE_foo=ON/OFF if the input name matches a feature
name. This is going to replace more complicated logic in our feature
evaluation.

Task-number: QTBUG-120529
Change-Id: I3ef45cd0e0a1462c53543cd2152eaf7f94318d9d
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Joerg Bornemann 2024-01-15 16:22:51 +01:00
parent 037439ad4b
commit be009c6857

View File

@ -994,9 +994,18 @@ if(cmake_file_api OR (developer_build AND NOT DEFINED cmake_file_api))
endforeach()
endif()
# Translate unhandled input variables to either -DINPUT_foo=value or -DFEATURE_foo=ON/OFF. If the
# input's name matches a feature name and the input's value is boolean then we assume it's
# controlling a feature.
set(valid_boolean_input_values yes no)
foreach(input ${config_inputs})
qt_feature_normalize_name("${input}" cmake_input)
if(input IN_LIST commandline_known_features
AND "${INPUT_${input}}" IN_LIST valid_boolean_input_values)
translate_boolean_input("${input}" "FEATURE_${cmake_input}")
else()
push("-DINPUT_${cmake_input}=${INPUT_${input}}")
endif()
endforeach()
if(no_prefix_option AND DEFINED INPUT_prefix)