configure: Translate only boolean options to features
This amends commit be009c6857.
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>
bb10
parent
c88b86fcc4
commit
110f656da9
|
|
@ -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}}")
|
||||
|
|
|
|||
Loading…
Reference in New Issue