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>
This commit is contained in:
Tobias Hunger 2018-11-14 14:24:34 +01:00
parent f37ce9ab84
commit fac800ad1c
3 changed files with 7 additions and 5 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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")