diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-04-20 20:31:31 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-04-21 09:01:27 +0200 |
commit | 8ef4edc09ea27ef301c866f812481cf0697cbfba (patch) | |
tree | 33fb501217f85e8382c46f5165145fdac015af03 /cmake/QtFeature.cmake | |
parent | a54294369d8bc7b98ed7d9d8ecf61774eec29782 (diff) |
CMake: Fix handling of negated feature config values
Consider a negated feature config value like the following:
qt_feature_config("foo" QMAKE_PUBLIC_QT_CONFIG NEGATE)
If this feature was disabled, it would turn up in both,
enabled_features and disabled_features of module .pri files.
Also, QT_CONFIG would contain foo.
Expected however is that QT_CONFIG contains no-foo, and only
disabled_features contains foo.
Fix this by prepending a "no_" prefix to the value, similar to the
"no-" prefix in the qmake build. The qt_correct_config function was
adjusted to recognize "no_foo" and translate it to the qmakeish
"no-foo" config value.
Config values that start with "no_" but do not correspond to a feature
are left untouched. You can still have values like
"no_valley_too_deep" or "no_mountain_too_high".
Change-Id: I23d8b18c84e04ea6dfa25cc6ccd8f7e86211b144
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtFeature.cmake')
-rw-r--r-- | cmake/QtFeature.cmake | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake index 4cf7c0f946..52475dfa85 100644 --- a/cmake/QtFeature.cmake +++ b/cmake/QtFeature.cmake @@ -312,16 +312,17 @@ function(qt_evaluate_qmake_config_values key) "FEATURE;NAME;CONFIG_VAR_NAME" "" ${${key}}) - set(expected "NOT") - if (arg_NEGATE) - set(expected "") - endif() - # If no custom name is specified, then the config value is the same as the feature name. if(NOT arg_NAME) set(arg_NAME "${arg_FEATURE}") endif() + set(expected "NOT") + if (arg_NEGATE) + set(expected "") + string(PREPEND arg_NAME "no_") + endif() + # The feature condition is false, there is no need to export any config values. if(${expected} ${QT_FEATURE_${arg_FEATURE}}) return() |