configure: Support lists for the CMAKE_VARIABLE argument

One can now add configure options of type 'addString' to qt_cmdline.cmake
files like so:
    qt_commandline_option(device-option
        TYPE addString
        CMAKE_VARIABLE QT_QMAKE_DEVICE_OPTIONS
    )

Additionally, the type 'stringList', a semicolon-separated list, was
added:
    qt_commandline_option(qpa
        TYPE stringList
        CMAKE_VARIABLE QT_QPA_PLATFORMS
    )

This removes the need to call translate_list_input for such arguments in
QtProcessConfigureArgs.cmake.

Task-number: QTBUG-123064
Change-Id: I8216c84afaf9a15db09e41e731701bb567ea3828
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Joerg Bornemann 2025-02-20 11:34:54 +01:00
parent bf05a67db3
commit bf272ce4ad
3 changed files with 12 additions and 4 deletions

View File

@ -516,6 +516,12 @@ function(qt_commandline_path arg val nextok)
qt_commandline_string("${arg}" "${val}" "${nextok}")
endfunction()
# Handle command line arguments of type "stringList" exactly like strings.
# They are treated differently by translate_input, however.
function(qt_commandline_stringList arg val nextok)
qt_commandline_string("${arg}" "${val}" "${nextok}")
endfunction()
function(qt_commandline_optionalString arg val nextok)
if("${val}" STREQUAL "")
if(nextok)
@ -861,6 +867,9 @@ macro(translate_input name cmake_var)
translate_path_input(${name} ${cmake_var})
elseif("${commandline_input_${name}_type}" STREQUAL "string")
translate_string_input(${name} ${cmake_var})
elseif("${commandline_input_${name}_type}" STREQUAL "addString"
OR "${commandline_input_${name}_type}" STREQUAL "stringList")
translate_list_input(${name} ${cmake_var})
else()
message(FATAL_ERROR
"translate_input cannot handle input '${name}' "
@ -966,7 +975,6 @@ if(NOT "${INPUT_device}" STREQUAL "")
drop_input(device)
endif()
guess_compiler_from_mkspec()
translate_list_input(qpa_platforms QT_QPA_PLATFORMS)
if(DEFINED INPUT_android-ndk-platform)
drop_input(android-ndk-platform)
@ -1046,7 +1054,7 @@ if("${INPUT_ltcg}" STREQUAL "yes")
endforeach()
endif()
translate_list_input(device-option QT_QMAKE_DEVICE_OPTIONS)
# Handle -D, -I and friends.
translate_list_input(defines QT_EXTRA_DEFINES)
translate_list_input(fpaths QT_EXTRA_FRAMEWORKPATHS)
translate_list_input(includes QT_EXTRA_INCLUDEPATHS)

View File

@ -64,7 +64,7 @@ qt_commandline_option(dbus-runtime TYPE void NAME dbus VALUE runtime)
qt_commandline_option(debug TYPE void)
qt_commandline_option(debug-and-release TYPE boolean NAME debug_and_release)
qt_commandline_option(device TYPE string)
qt_commandline_option(device-option TYPE addString)
qt_commandline_option(device-option TYPE addString CMAKE_VARIABLE QT_QMAKE_DEVICE_OPTIONS)
qt_commandline_option(f16c TYPE boolean)
qt_commandline_option(force-asserts TYPE boolean NAME force_asserts)
qt_commandline_option(force-debug-info TYPE boolean NAME force_debug_info)

View File

@ -28,7 +28,7 @@ qt_commandline_option(opengl TYPE optionalString VALUES no yes desktop es2 dynam
qt_commandline_option(opengl-es-2 TYPE void NAME opengl VALUE es2)
qt_commandline_option(opengles3 TYPE boolean)
qt_commandline_option(openvg TYPE boolean)
qt_commandline_option(qpa TYPE string NAME qpa_platforms)
qt_commandline_option(qpa TYPE stringList NAME qpa_platforms CMAKE_VARIABLE QT_QPA_PLATFORMS)
qt_commandline_option(default-qpa
TYPE string
NAME qpa_default_platform