configure: Fix -c++std and -sanitize options

This amends commit 110f656da9e9b2511c89679e79b197a3e7b07393.

Command line options with a TYPE that denotes a custom command line
argument handler cannot set a feature "foo" anymore by just setting
INPUT_foo to "yes". Instead, they must use the newly introduced
functions qtConfCommandlineEnableFeature and
qtConfCommandlineDisableFeature.

These functions will set INPUT_foo and augment the input with the
information "this input is of boolean type". This information is used
when deciding whether to use this input as feature switch.

Change-Id: I83c691cc57424159148f059c2a1c8cd72e39ee63
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2024-03-11 14:09:01 +01:00
parent e685bfe764
commit c11beb8d32
2 changed files with 30 additions and 10 deletions

View File

@ -287,7 +287,7 @@ function(qt_commandline_option name)
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)
set_property(GLOBAL PROPERTY INPUTTYPE_${input_name} "${arg_TYPE}")
if(NOT "${arg_VALUE}" STREQUAL "")
set(commandline_option_${name}_value "${arg_VALUE}" PARENT_SCOPE)
endif()
@ -378,6 +378,23 @@ function(qtConfCommandlineAppendInput name val)
qtConfCommandlineSetInput(${name} "${val}")
endfunction()
function(qtConfCommandlineSetInputType input_name type_name)
set_property(GLOBAL PROPERTY INPUTTYPE_${input_name} "${type_name}")
endfunction()
function(qtConfCommandlineSetBooleanInput name val)
qtConfCommandlineSetInput(${name} ${val})
qtConfCommandlineSetInputType(${name} boolean)
endfunction()
function(qtConfCommandlineEnableFeature name)
qtConfCommandlineSetBooleanInput(${name} yes)
endfunction()
function(qtConfCommandlineDisableFeature name)
qtConfCommandlineSetBooleanInput(${name} no)
endfunction()
function(qtConfValidateValue opt val out_var)
set(${out_var} TRUE PARENT_SCOPE)
@ -753,6 +770,9 @@ get_property(config_inputs GLOBAL PROPERTY CONFIG_INPUTS)
list(REMOVE_DUPLICATES config_inputs)
foreach(var ${config_inputs})
get_property(INPUT_${var} GLOBAL PROPERTY INPUT_${var})
if("${commandline_input_type}" STREQUAL "")
get_property(commandline_input_${var}_type GLOBAL PROPERTY INPUTTYPE_${var})
endif()
endforeach()
macro(drop_input name)

View File

@ -145,11 +145,11 @@ function(qt_commandline_cxxstd arg val nextok)
return()
endif()
if(val MATCHES "(c\\+\\+)?(20|2a)")
qtConfCommandlineSetInput(c++20 yes)
qtConfCommandlineSetInput(c++2b no)
qtConfCommandlineEnableFeature(c++20)
qtConfCommandlineDisableFeature(c++2b)
elseif(val MATCHES "(c\\+\\+)?(2b)")
qtConfCommandlineSetInput(c++20 yes)
qtConfCommandlineSetInput(c++2b yes)
qtConfCommandlineEnableFeature(c++20)
qtConfCommandlineEnableFeature(c++2b)
else()
qtConfAddError("Invalid argument '${val}' to command line parameter '${arg}'")
endif()
@ -164,15 +164,15 @@ function(qt_commandline_sanitize arg val nextok)
return()
endif()
if(val STREQUAL "address")
qtConfCommandlineSetInput(sanitize_address yes)
qtConfCommandlineEnableFeature(sanitize_address)
elseif(val STREQUAL "thread")
qtConfCommandlineSetInput(sanitize_thread yes)
qtConfCommandlineEnableFeature(sanitize_thread)
elseif(val STREQUAL "memory")
qtConfCommandlineSetInput(sanitize_memory yes)
qtConfCommandlineEnableFeature(sanitize_memory)
elseif(val STREQUAL "fuzzer-no-link")
qtConfCommandlineSetInput(sanitize_fuzzer_no_link yes)
qtConfCommandlineEnableFeature(sanitize_fuzzer_no_link)
elseif(val STREQUAL "undefined")
qtConfCommandlineSetInput(sanitize_undefined yes)
qtConfCommandlineEnableFeature(sanitize_undefined)
else()
qtConfAddError("Invalid argument '${val}' to command line parameter '${arg}'")
endif()