configure: Fix -system-zlib and -system-sqlite options

These options are declared with TYPE enum and a MAPPING that's supposed
to control the feature 'system-zlib' or 'system-sqlite'. Since only
inputs of type boolean control features now, we need to somehow declare
that this non-boolean input controls a feature.

We do this by adding the keyword CONTROLS_FEATURE to
qt_commandline_option. For example,

    qt_commandline_option(zlib
        CONTROLS_FEATURE
        TYPE enum
        NAME system-zlib
        MAPPING system yes qt no
    )

declares
- commandline option "zlib" sets the input "system-zlib",
  because of the "NAME system-zlib" argument
- accepted input values are "system" and "qt", because
  we have "TYPE enum" and the odd values of MAPPING
- those values are translated to yes/no, because of the
  even values of MAPPING
- CONTROLS_FEATURE forces the translated input's type
  to boolean, and with that it will set the corresponding
  feature 'system-zlib'

Luckily, only qtbase has command line options with MAPPING declared.

Change-Id: I82d06cec43ece3b002c8f5dd414c68dc730909af
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2024-03-14 15:59:31 +01:00
parent 52c7357fce
commit 6e12a298f4
3 changed files with 8 additions and 4 deletions

View File

@ -275,7 +275,7 @@ macro(qt_commandline_custom handler)
endmacro()
function(qt_commandline_option name)
set(options)
set(options CONTROLS_FEATURE)
set(oneValueArgs TYPE NAME VALUE)
set(multiValueArgs VALUES MAPPING)
cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
@ -287,7 +287,11 @@ function(qt_commandline_option name)
set(input_name ${arg_NAME})
set(commandline_option_${name}_variable "${arg_NAME}" PARENT_SCOPE)
endif()
set_property(GLOBAL PROPERTY INPUTTYPE_${input_name} "${arg_TYPE}")
set(mapping_type "${arg_TYPE}")
if(arg_CONTROLS_FEATURE)
set(mapping_type "boolean")
endif()
set_property(GLOBAL PROPERTY INPUTTYPE_${input_name} "${mapping_type}")
if(NOT "${arg_VALUE}" STREQUAL "")
set(commandline_option_${name}_value "${arg_VALUE}" PARENT_SCOPE)
endif()

View File

@ -127,7 +127,7 @@ qt_commandline_option(warnings-are-errors TYPE boolean NAME warnings_are_errors)
qt_commandline_option(Werror TYPE boolean NAME warnings_are_errors)
qt_commandline_option(widgets TYPE boolean)
qt_commandline_option(xplatform TYPE string)
qt_commandline_option(zlib TYPE enum NAME system-zlib MAPPING system yes qt no)
qt_commandline_option(zlib CONTROLS_FEATURE TYPE enum NAME system-zlib MAPPING system yes qt no)
qt_commandline_option(zstd TYPE boolean)
qt_commandline_option(coverage TYPE optionalString VALUES gcov)
qt_commandline_prefix(D defines)

View File

@ -3,7 +3,7 @@
qt_commandline_option(mysql_config TYPE string)
qt_commandline_option(psql_config TYPE string)
qt_commandline_option(sqlite TYPE enum NAME system-sqlite MAPPING qt no system yes)
qt_commandline_option(sqlite CONTROLS_FEATURE TYPE enum NAME system-sqlite MAPPING qt no system yes)
qt_commandline_option(sql-db2 TYPE boolean)
qt_commandline_option(sql-ibase TYPE boolean)
qt_commandline_option(sql-mysql TYPE boolean)