diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2020-11-18 13:17:47 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-11-20 19:46:06 +0000 |
commit | 02c6d57cabecb0624768eeb31e74ec2e9c93f59e (patch) | |
tree | 6c4af23d4e7afe71594140b30012eb9ae3fadec5 /cmake | |
parent | 7e34b7fa4d9e8b0f5d6c5276abd727022c091d8d (diff) |
CMake: Change way of 'INPUT_' values handling
Move 'INPUT_' variable detection logic out of
'qt_feature_set_cache_value' function. Use 'INPUT_'
variable to enable/disable related 'FEATURE_' in case if
'FEATURE_' is not defined.
Fixes: QTBUG-88501
Change-Id: I1162ac0fb562036898a37b52c3f80229ec8a0970
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 85f0792d2b10994e9e5fa70de50aa0ac39e98e20)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtFeature.cmake | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake index ed51bc8f68..6a93ed3924 100644 --- a/cmake/QtFeature.cmake +++ b/cmake/QtFeature.cmake @@ -171,13 +171,6 @@ function(qt_evaluate_config_expression resultVar) endfunction() function(qt_feature_set_cache_value resultVar feature emit_if calculated label) - # Enable FEATURE_ variable if INPUT_ is true-like. FEATURE_ value has higher priority. - string(TOUPPER "${INPUT_${feature}}" input_value) - set(booly_values ON YES TRUE Y 1) - if ((NOT DEFINED "FEATURE_${feature}") AND (input_value IN_LIST booly_values)) - set(FEATURE_${feature} ON) - endif() - if (DEFINED "FEATURE_${feature}") # Must set up the cache if (NOT (emit_if)) @@ -207,7 +200,7 @@ function(qt_feature_set_cache_value resultVar feature emit_if calculated label) set("${resultVar}" "${result}" PARENT_SCOPE) endfunction() -macro(qt_feature_set_value feature cache emit_if condition label) +macro(qt_feature_set_value feature cache condition label) set(result "${cache}") if (NOT (condition) AND (cache)) @@ -280,8 +273,19 @@ function(qt_evaluate_feature feature) message(FATAL_ERROR "Sanity check failed: Feature ${feature} is enabled but condition does not hold true.") endif() + # If FEATURE_ is not defined trying to use INPUT_ variable to enable/disable feature. + if ((NOT DEFINED "FEATURE_${feature}") AND (DEFINED "INPUT_${feature}") + AND (NOT "${INPUT_${feature}}" STREQUAL "undefined") + AND (NOT "${INPUT_${feature}}" STREQUAL "")) + if(INPUT_${feature}) + set(FEATURE_${feature} ON) + else() + set(FEATURE_${feature} OFF) + endif() + endif() + qt_feature_set_cache_value(cache "${feature}" "${emit_if}" "${result}" "${arg_LABEL}") - qt_feature_set_value("${feature}" "${cache}" "${emit_if}" "${condition}" "${arg_LABEL}") + qt_feature_set_value("${feature}" "${cache}" "${condition}" "${arg_LABEL}") # Store each feature's label for summary info. set(QT_FEATURE_LABEL_${feature} "${arg_LABEL}" CACHE INTERNAL "") |