summaryrefslogtreecommitdiffstats
path: root/cmake/QtFeature.cmake
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2020-11-03 14:08:26 +0100
committerAlexey Edelev <alexey.edelev@qt.io>2020-11-03 16:28:14 +0100
commitdc43061e9abb15bc07eb236f5344c79d27590812 (patch)
treecce3c881724bed0666b3080d4a8209d2d6c57e95 /cmake/QtFeature.cmake
parentf8c30759d98603908b408464ea6d98413fc81eec (diff)
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 <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtFeature.cmake')
-rw-r--r--cmake/QtFeature.cmake12
1 files changed, 10 insertions, 2 deletions
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}")