Store QT_FEATUREs that are not emitted

Store QT_FEATUREs that are not emitted, but do not show them in the UI. Also separate
out the UI (FEATURE_foo) from the internal CMake value (QT_FEATURE_foo). This does
break the overriding of settings, but that did not work well before either. This
will be fixed in follow-up patches.

Remove fallout: xkbcommon_system was now evaluated where it was not before. Remove
it as that is always the case now.

Change-Id: I2d303827a1cc9afeef93ad73285a2043ddaa9766
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Tobias Hunger 2018-10-25 13:16:42 +02:00
parent 465da04bcb
commit ec510d0ebc
2 changed files with 18 additions and 28 deletions

View File

@ -32,22 +32,14 @@ function(qt_feature _feature)
"PRIVATE;PUBLIC" "PRIVATE;PUBLIC"
"LABEL;PURPOSE;SECTION;" "AUTODETECT;CONDITION;ENABLE;DISABLE;EMIT_IF" ${ARGN}) "LABEL;PURPOSE;SECTION;" "AUTODETECT;CONDITION;ENABLE;DISABLE;EMIT_IF" ${ARGN})
if("${_arg_EMIT_IF}" STREQUAL "") # Register feature for future use:
set(_arg_EMIT_IF 1) if (_arg_PUBLIC)
list(APPEND __QtFeature_public_features "${_feature}")
endif()
if (_arg_PRIVATE)
list(APPEND __QtFeature_private_features "${_feature}")
endif() endif()
if (${_arg_EMIT_IF})
set(QT_FEATURE_${_feature} "UNSET" CACHE STRING "${_arg_LABEL}")
set_property(CACHE QT_FEATURE_${_feature} PROPERTY STRINGS UNSET ON OFF)
# Register feature for future use:
if (_arg_PUBLIC)
list(APPEND __QtFeature_public_features "${_feature}")
endif()
if (_arg_PRIVATE)
list(APPEND __QtFeature_private_features "${_feature}")
endif()
endif()
set(__QtFeature_public_features ${__QtFeature_public_features} PARENT_SCOPE) set(__QtFeature_public_features ${__QtFeature_public_features} PARENT_SCOPE)
set(__QtFeature_private_features ${__QtFeature_private_features} PARENT_SCOPE) set(__QtFeature_private_features ${__QtFeature_private_features} PARENT_SCOPE)
endfunction() endfunction()
@ -114,7 +106,7 @@ function(qt_evaluate_config_expression resultVar)
elseif("${member}" STREQUAL "STREQUAL" AND memberIdx LESS ${length}) elseif("${member}" STREQUAL "STREQUAL" AND memberIdx LESS ${length})
# Unfortunately the semantics for STREQUAL in if() are broken when the # Unfortunately the semantics for STREQUAL in if() are broken when the
# RHS is an empty string and the parameters to if are coming through a variable. # RHS is an empty string and the parameters to if are coming through a variable.
# So we expect people two write the empty string with single quotes and then we # So we expect people to write the empty string with single quotes and then we
# do the comparison manually here. # do the comparison manually here.
list(LENGTH result lhsIndex) list(LENGTH result lhsIndex)
math(EXPR lhsIndex "${lhsIndex}-1") math(EXPR lhsIndex "${lhsIndex}-1")
@ -157,7 +149,8 @@ endfunction()
function(qt_evaluate_feature _feature) function(qt_evaluate_feature _feature)
# If the feature was set explicitly by the user to be on or off, in the cache, then # If the feature was set explicitly by the user to be on or off, in the cache, then
# there's nothing for us to do. # there's nothing for us to do.
if(NOT QT_FEATURE_${_feature} STREQUAL UNSET) if(DEFINED "QT_FEATURE_${_feature}")
message("${_feature} is already defined...")
return() return()
endif() endif()
@ -201,6 +194,15 @@ function(qt_evaluate_feature _feature)
set(QT_FEATURE_COMPUTED_VALUE_${_feature} "${result}" CACHE INTERNAL "${_arg_LABEL}") set(QT_FEATURE_COMPUTED_VALUE_${_feature} "${result}" CACHE INTERNAL "${_arg_LABEL}")
set(QT_FEATURE_${_feature} "${result}" PARENT_SCOPE) set(QT_FEATURE_${_feature} "${result}" PARENT_SCOPE)
if("${_arg_EMIT_IF}" STREQUAL "")
set(_arg_EMIT_IF ON)
endif()
if (${_arg_EMIT_IF})
set(FEATURE_${_feature} "UNSET" CACHE STRING "${_arg_LABEL}")
set_property(CACHE FEATURE_${_feature} PROPERTY STRINGS UNSET ON OFF)
endif()
endfunction() endfunction()
function(qt_feature_definition _feature _name) function(qt_feature_definition _feature _name)

View File

@ -122,18 +122,6 @@ extend_target(XcbQpa CONDITION QT_FEATURE_vulkan
#extend_target(XcbQpa CONDITION NOT QT_FEATURE_xkbcommon_system #extend_target(XcbQpa CONDITION NOT QT_FEATURE_xkbcommon_system
#) #)
extend_target(XcbQpa CONDITION (NOT QT_FEATURE_xkbcommon_system) AND (QT_FEATURE_xkb)
INCLUDE_DIRECTORIES
../../../3rdparty/xkbcommon/src/x11
)
extend_target(XcbQpa CONDITION (NOT QT_FEATURE_xkbcommon_system) AND (NOT QT_FEATURE_xkb)
INCLUDE_DIRECTORIES
../../../3rdparty/xkbcommon
../../../3rdparty/xkbcommon/xkbcommon
../../../3rdparty/xkbcommon/src
../../../3rdparty/xkbcommon/src/xkbcomp
)
# #
#extend_target(XcbQpa CONDITION NOT NOT QT_FEATURE_xkbcommon_system #extend_target(XcbQpa CONDITION NOT NOT QT_FEATURE_xkbcommon_system
#) #)