diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2018-11-14 14:24:34 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2018-11-22 08:39:15 +0000 |
commit | fac800ad1c5355e9002bf819ae06923a4edaf572 (patch) | |
tree | b52d5637499df573566f446ee3d67bc072938ecd /cmake | |
parent | f37ce9ab84400a45752787b9e015a7919c8771bd (diff) |
CMake: Fix cmake test for features
Features are now always defined (to OFF) when they are not emitted.
Adapt the test for that.
Change-Id: Id5f662f07fea15c22027b9b00d1b53a288b4a0dc
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtFeature.cmake | 8 | ||||
-rw-r--r-- | cmake/tests/features/CMakeLists.txt | 2 | ||||
-rw-r--r-- | cmake/tests/features/src/CMakeLists.txt | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake index 6330200fd1..2ebf7e86e6 100644 --- a/cmake/QtFeature.cmake +++ b/cmake/QtFeature.cmake @@ -166,14 +166,16 @@ function(qt_feature_set_cache_value resultVar feature emit_if calculated label) # Initial setup: if (emit_if) set("FEATURE_${feature}" "${calculated}" CACHE BOOL "${label}") + set(result "${calculated}") + else() + set(result OFF) endif() - set(result "${calculated}") endif() set("${resultVar}" "${result}" PARENT_SCOPE) endfunction() -macro(qt_feature_set_value feature cache condition label) +macro(qt_feature_set_value feature cache emit_if condition label) set(result "${cache}") if (NOT (condition) AND (cache)) @@ -241,7 +243,7 @@ function(qt_evaluate_feature _feature) endif() qt_feature_set_cache_value(cache "${_feature}" "${emit_if}" "${result}" "${_arg_LABEL}") - qt_feature_set_value("${_feature}" "${cache}" "${condition}" "${_arg_LABEL}") + qt_feature_set_value("${_feature}" "${cache}" "${emit_if}" "${condition}" "${_arg_LABEL}") endfunction() function(qt_feature_definition _feature _name) diff --git a/cmake/tests/features/CMakeLists.txt b/cmake/tests/features/CMakeLists.txt index 7b76a4529f..e255b209c9 100644 --- a/cmake/tests/features/CMakeLists.txt +++ b/cmake/tests/features/CMakeLists.txt @@ -28,7 +28,7 @@ assert(QT_FEATURE_top_b STREQUAL "OFF") assert(QT_FEATURE_top_enabled STREQUAL "ON") assert(QT_FEATURE_top_disabled STREQUAL "OFF") assert(QT_FEATURE_top_disabled_enabled STREQUAL "OFF") -assert(NOT DEFINED QT_FEATURE_top_not_emitted) +assert(QT_FEATURE_top_not_emitted STREQUAL "OFF") ## Enable feature summary at the end of the configure run: include(FeatureSummary) diff --git a/cmake/tests/features/src/CMakeLists.txt b/cmake/tests/features/src/CMakeLists.txt index 1a31dbc8c5..bfb02be07d 100644 --- a/cmake/tests/features/src/CMakeLists.txt +++ b/cmake/tests/features/src/CMakeLists.txt @@ -4,4 +4,4 @@ assert(QT_FEATURE_top_b STREQUAL "OFF") assert(QT_FEATURE_top_enabled STREQUAL "ON") assert(QT_FEATURE_top_disabled STREQUAL "OFF") assert(QT_FEATURE_top_disabled_enabled STREQUAL "OFF") -assert(NOT DEFINED QT_FEATURE_top_not_emitted) +assert(QT_FEATURE_top_not_emitted STREQUAL "OFF") |