summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2020-11-04 16:00:50 +0100
committerAlexey Edelev <alexey.edelev@qt.io>2020-11-06 10:16:31 +0100
commitaa6ad154243b514cd55b10af64b72f4fa3d1cd02 (patch)
tree09b748d022e89313a095366d415e70913d4f2566 /cmake
parent501f27b5c6a62e835fb9854b0aa360371ecfb366 (diff)
CMake: Rework INPUT_ variables handling
INPUT_ variables enable FEATURE_ variable only in case if valid "true"-like value is assigned from command line. Amends dc43061e9abb15bc07eb236f5344c79d27590812 Fixes: QTBUG-87755 Task-number: QTBUG-88142 Change-Id: I65e85c7548981fdec94366b531f6df6396be71b7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtFeature.cmake19
1 files changed, 9 insertions, 10 deletions
diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake
index acf120dfcf..ed51bc8f68 100644
--- a/cmake/QtFeature.cmake
+++ b/cmake/QtFeature.cmake
@@ -171,24 +171,23 @@ function(qt_evaluate_config_expression resultVar)
endfunction()
function(qt_feature_set_cache_value resultVar feature emit_if calculated label)
- # 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}")
+ # Enable FEATURE_ variable if INPUT_ is true-like. FEATURE_ value has higher priority.
+ string(TOUPPER "${INPUT_${feature}}" input_value)
+ set(booly_values ON YES TRUE Y 1)
+ if ((NOT DEFINED "FEATURE_${feature}") AND (input_value IN_LIST booly_values))
+ set(FEATURE_${feature} ON)
endif()
- if(NOT "${feature_var}" STREQUAL "")
+ if (DEFINED "FEATURE_${feature}")
# 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_var}}")
- set(booly_values OFF NO FALSE N ON YES TRUE Y)
- if ((cache IN_LIST booly_values) OR (cache GREATER_EQUAL 0))
+ set(cache "${FEATURE_${feature}}")
+ set(bool_values OFF NO FALSE N ON YES TRUE Y)
+ if ((cache IN_LIST bool_values) OR (cache GREATER_EQUAL 0))
set(result "${cache}")
else()
message(FATAL_ERROR "Sanity check failed: FEATURE_${feature} has invalid value \"${cache}\"!")