CMake: Allow lower-case values in feature values

CMake considers ON/OFF as booly string values regardless of the case.

Make the value comparison in QtFeature.cmake case-independent.
It's now possible to build Qt with '-DFEATURE_gui=off'.

Fixes: QTBUG-87948
Change-Id: I3d948e8219ad9728414803c8c4cd756034073b46
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Rolf Eike Beer <eb@emlix.com>
This commit is contained in:
Joerg Bornemann 2020-10-27 12:56:24 +01:00
parent b77cf10a4f
commit 91384c9918

View File

@ -406,14 +406,16 @@ function(qt_extra_definition name value)
endfunction()
function(qt_internal_generate_feature_line line feature)
if (QT_FEATURE_${feature} STREQUAL "ON")
string(TOUPPER "${QT_FEATURE_${feature}}" value)
if (value STREQUAL "ON")
set(line "#define QT_FEATURE_${feature} 1\n\n" PARENT_SCOPE)
elseif(QT_FEATURE_${feature} STREQUAL "OFF")
elseif(value STREQUAL "OFF")
set(line "#define QT_FEATURE_${feature} -1\n\n" PARENT_SCOPE)
elseif(QT_FEATURE_${feature} STREQUAL "UNSET")
elseif(value STREQUAL "UNSET")
set(line "#define QT_FEATURE_${feature} 0\n\n" PARENT_SCOPE)
else()
message(FATAL_ERROR "${feature} has unexpected value \"${QT_FEATURE_${feature}}\"!")
message(FATAL_ERROR "${feature} has unexpected value \"${QT_FEATURE_${feature}}\"! "
"Valid values are ON, OFF and UNSET.")
endif()
endfunction()