diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake index 6330200fd17..2ebf7e86e6e 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 7b76a4529fe..e255b209c9e 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 1a31dbc8c5f..bfb02be07dc 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")