CMake: Yield error if a feature is ENABLEd and CONDITION is false
Consider a feature that has ENABLE and CONDITION expressions. For example, system-libb2 on a Linux machine that does not have the libb2-dev package installed: qt_feature("system-libb2" PRIVATE LABEL "Using system libb2" CONDITION Libb2_FOUND ENABLE INPUT_libb2 STREQUAL 'system' DISABLE INPUT_libb2 STREQUAL 'no' OR INPUT_libb2 STREQUAL 'qt' ) If the feature is enabled by the user by setting FEATURE_system_libb2=ON, then there's an error: Feature "system_libb2": Forcing to "ON" breaks its condition... This is expected. If the feature is enabled by the user by triggering the ENABLE condition via the -system-libb2 configure flag (that sets INPUT_libb2 to "system"), we did not get an error message. This was unexpected and inconsistent. Now, we consider features that are enabled via their ENABLE condition as set by the user and yield an error if the CONDITION doesn't match. Fixes: QTBUG-126144 Change-Id: I249baf9ab4f434f5a96894f4ec055f70859ffca9 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit ad227368c3ab3a9dc68208bce2d075edefe7e6e0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
fff5c065bc
commit
5280f307a8
@ -401,7 +401,9 @@ function(qt_evaluate_feature feature)
|
||||
qt_evaluate_config_expression(auto_detect ${arg_AUTODETECT})
|
||||
if(${disable_result})
|
||||
set(computed OFF)
|
||||
elseif((${enable_result}) OR (${auto_detect}))
|
||||
elseif(${enable_result})
|
||||
set(computed ON)
|
||||
elseif(${auto_detect})
|
||||
set(computed ${condition})
|
||||
else()
|
||||
# feature not auto-detected and not explicitly enabled
|
||||
|
Loading…
x
Reference in New Issue
Block a user