cmake: Fix is_feature_enabled and set_feature_disabled

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2021-10-23 21:03:42 +02:00 committed by Xaymar
parent 31eb7a3ad1
commit 32f53ed2ca

View file

@ -596,19 +596,19 @@ endif()
# 3. Again check which features are enabled, if their requirements are missing, warn about it and disable them. # 3. Again check which features are enabled, if their requirements are missing, warn about it and disable them.
# TODO: Consider making this an error instead. # TODO: Consider making this an error instead.
function(is_feature_enabled FEATURE OUTPUT) macro(is_feature_enabled FEATURE OUTPUT)
set(T_ENABLED ${${PREFIX}ENABLE_${FEATURE}}) set(T_ENABLED ${${PREFIX}ENABLE_${FEATURE}})
set(T_DISABLED ${${PREFIX}DISABLE_${FEATURE}}) set(T_DISABLED ${${PREFIX}DISABLE_${FEATURE}})
if(T_ENABLED AND NOT T_DISABLED) if(T_ENABLED AND NOT T_DISABLED)
set(${OUTPUT} ON PARENT_SCOPE) set(${OUTPUT} ON)
else() else()
set(${PREFIX}DISABLE_${FEATURE} ON PARENT_SCOPE) # set(${PREFIX}DISABLE_${FEATURE} ON CACHE INTERNAL "" FORCE)
set(${OUTPUT} OFF PARENT_SCOPE) set(${OUTPUT} OFF)
endif() endif()
endfunction() endmacro()
macro(set_feature_disabled FEATURE DISABLED) macro(set_feature_disabled FEATURE DISABLED)
set(${PREFIX}DISABLE_${FEATURE} ${DISABLED} PARENT_SCOPE) set(${PREFIX}DISABLE_${FEATURE} ${DISABLED} CACHE INTERNAL "" FORCE)
endmacro() endmacro()
# Features # Features