From 992fe06b30337442b96e5f8b6553e518fedcd372 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 26 Sep 2019 15:39:06 +0200 Subject: [PATCH] cmake: Support CMake-typical booly values for -DFEATURE_* Allow setting feature defines to ON, YES, TRUE, Y, OFF, NO, FALSE, N and non-negative numbers like it's possible for other defines. We'll not allow IGNORE and NOTFOUND, because they're a bit strange in the context of features. Change-Id: I7f6cd6dff4c68972921b499b28916c9ad789d510 Reviewed-by: Alexandru Croitor Reviewed-by: Qt CMake Build Bot --- cmake/QtFeature.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake index 9d0e408980a..3a8a04c253d 100644 --- a/cmake/QtFeature.cmake +++ b/cmake/QtFeature.cmake @@ -163,7 +163,8 @@ function(qt_feature_set_cache_value resultVar feature emit_if calculated label) # Revisit value: set(cache "${FEATURE_${feature}}") - if ((cache STREQUAL "ON") OR (cache STREQUAL "OFF")) + 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}") else() message(FATAL_ERROR "Sanity check failed: FEATURE_${feature} has invalid value \"${cache}\"!")