summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2024-03-01 20:59:53 +0100
committerJoerg Bornemann <joerg.bornemann@qt.io>2024-03-05 12:59:21 +0100
commit110f656da9e9b2511c89679e79b197a3e7b07393 (patch)
tree99969cf62e5f8f7863571c0e9163ee571892a1aa
parentc88b86fcc4fb39eff6fc3b08e045efadc076ca38 (diff)
configure: Translate only boolean options to features
This amends commit be009c6857dc75c0bdf789c4ac9323f0cf1fd9e6. The configure option -no-opengl was mistakenly translated to the CMake argument -DFEATURE_opengl=no. The command line option "opengl" however is defined as qt_commandline_option(opengl TYPE optionalString VALUES no yes desktop es2 dynamic ) which is not boolean. And only boolean command-line options may automagically control features of the same name. It just happens that the values "no" and "yes" look boolean. Setting FEATURE_opengl instead of INPUT_opengl broke feature conditions that check the INPUT_opengl value. Fix this by checking the type of the corresponding command line option instead of guessing the type from the INPUT_* value. An option (e.g. force-asserts) can be diverted to a differently named input (e.g. force_asserts) with the NAME argument of qt_commandline_option. In this case, we cannot deduce the option name from the input's name. To handle this, we store the input's type in commandline_input_${name}_type and read it when translating feature values. Fixes: QTBUG-122914 Change-Id: Ibb4b0633b6635bd2ef6f26ed8f4b19d239bf5854 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--cmake/QtProcessConfigureArgs.cmake12
1 files changed, 7 insertions, 5 deletions
diff --git a/cmake/QtProcessConfigureArgs.cmake b/cmake/QtProcessConfigureArgs.cmake
index 00337b3b70..02e6de9516 100644
--- a/cmake/QtProcessConfigureArgs.cmake
+++ b/cmake/QtProcessConfigureArgs.cmake
@@ -282,9 +282,12 @@ function(qt_commandline_option name)
set(commandline_known_options "${commandline_known_options};${name}" PARENT_SCOPE)
set(commandline_option_${name} "${arg_TYPE}" PARENT_SCOPE)
+ set(input_name ${name})
if(NOT "${arg_NAME}" STREQUAL "")
+ set(input_name ${arg_NAME})
set(commandline_option_${name}_variable "${arg_NAME}" PARENT_SCOPE)
endif()
+ set(commandline_input_${input_name}_type "${arg_TYPE}" PARENT_SCOPE)
if(NOT "${arg_VALUE}" STREQUAL "")
set(commandline_option_${name}_value "${arg_VALUE}" PARENT_SCOPE)
endif()
@@ -1009,13 +1012,12 @@ if(cmake_file_api OR (developer_build AND NOT DEFINED cmake_file_api))
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)
+# input's name matches a feature name and the corresponding command-line option's type is boolean
+# then we assume it's controlling a feature.
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)
+ if("${commandline_input_${input}_type}" STREQUAL "boolean"
+ AND input IN_LIST commandline_known_features)
translate_boolean_input("${input}" "FEATURE_${cmake_input}")
else()
push("-DINPUT_${cmake_input}=${INPUT_${input}}")