From be009c6857dc75c0bdf789c4ac9323f0cf1fd9e6 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 15 Jan 2024 16:22:51 +0100 Subject: [PATCH] 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 --- cmake/QtProcessConfigureArgs.cmake | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmake/QtProcessConfigureArgs.cmake b/cmake/QtProcessConfigureArgs.cmake index 74d60fe815c..d26f9c06b49 100644 --- a/cmake/QtProcessConfigureArgs.cmake +++ b/cmake/QtProcessConfigureArgs.cmake @@ -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) - push("-DINPUT_${cmake_input}=${INPUT_${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)