diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2024-03-14 15:59:31 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2024-03-27 06:56:09 +0100 |
commit | 6e12a298f459eb66bf2fc28f5ff36202436c2e0b (patch) | |
tree | 1c44ce5a02c0eb7fb7c6a6943f53152d9f0a21cc | |
parent | 52c7357fced9f10fafba68344781ceab48fc1b16 (diff) |
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>
-rw-r--r-- | cmake/QtProcessConfigureArgs.cmake | 8 | ||||
-rw-r--r-- | qt_cmdline.cmake | 2 | ||||
-rw-r--r-- | src/plugins/sqldrivers/qt_cmdline.cmake | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/cmake/QtProcessConfigureArgs.cmake b/cmake/QtProcessConfigureArgs.cmake index 2080d3222a..97bf49efbe 100644 --- a/cmake/QtProcessConfigureArgs.cmake +++ b/cmake/QtProcessConfigureArgs.cmake @@ -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() diff --git a/qt_cmdline.cmake b/qt_cmdline.cmake index 5e7cc32356..11ba47854a 100644 --- a/qt_cmdline.cmake +++ b/qt_cmdline.cmake @@ -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) diff --git a/src/plugins/sqldrivers/qt_cmdline.cmake b/src/plugins/sqldrivers/qt_cmdline.cmake index 945de0e63b..2bb1fc64eb 100644 --- a/src/plugins/sqldrivers/qt_cmdline.cmake +++ b/src/plugins/sqldrivers/qt_cmdline.cmake @@ -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) |