From dc43061e9abb15bc07eb236f5344c79d27590812 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Tue, 3 Nov 2020 14:08:26 +0100 Subject: CMake: Add handling of user-defined INPUT_foo cache variables "configure" script translates feature-related parameters to INPUT_ variables instead of FEATURE_. Both INPUT_ and FEATURE_ variables passed to cmake script are equivalent. FEATURE_ has higher priority in case if both are defined. Fixes: QTBUG-87755 Change-Id: If697a0d62ab839877a3196ea74e631582a570dda Reviewed-by: Alexandru Croitor --- cmake/QtFeature.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'cmake/QtFeature.cmake') diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake index aa59a14ff9..acf120dfcf 100644 --- a/cmake/QtFeature.cmake +++ b/cmake/QtFeature.cmake @@ -171,14 +171,22 @@ function(qt_evaluate_config_expression resultVar) endfunction() function(qt_feature_set_cache_value resultVar feature emit_if calculated label) - if (DEFINED "FEATURE_${feature}") + # Check if either FEATURE_ or INPUT_ are provided by user. INPUT_ also might be set + # when cmake is run by "configure" script. + if(DEFINED "FEATURE_${feature}") + set(feature_var "FEATURE_${feature}") + elseif(DEFINED "INPUT_${feature}" AND NOT "${INPUT_${feature}}" STREQUAL "undefined") + set(feature_var "INPUT_${feature}") + endif() + + if(NOT "${feature_var}" STREQUAL "") # Must set up the cache if (NOT (emit_if)) message(FATAL_ERROR "Sanity check failed: FEATURE_${feature} that was not emitted was found in the CMakeCache.") endif() # Revisit value: - set(cache "${FEATURE_${feature}}") + set(cache "${${feature_var}}") set(booly_values OFF NO FALSE N ON YES TRUE Y) if ((cache IN_LIST booly_values) OR (cache GREATER_EQUAL 0)) set(result "${cache}") -- cgit v1.2.3