From 182aa6b67762a0702291181d9d47cae1a239a96f Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Sat, 26 Nov 2022 17:23:56 -0600 Subject: [PATCH] CMake: bugfix: make sure that cached feature variables do not interfere --- cmake/macros/macro_clear_feature.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmake/macros/macro_clear_feature.cmake b/cmake/macros/macro_clear_feature.cmake index 7e8b4b3757..898a1d1a73 100644 --- a/cmake/macros/macro_clear_feature.cmake +++ b/cmake/macros/macro_clear_feature.cmake @@ -27,6 +27,17 @@ macro(clear_feature _feature) foreach(_var ${DEAL_II_LIST_SUFFIXES} ${DEAL_II_STRING_SUFFIXES}) unset(${_feature}_${_var}) + # + # If an unset variable is still defined then it is a cached variable. + # We want to retain this cached variable because it has been set by the + # user (and might have been used for the feature configuration). But it + # is important that we clear the variable so that the process_feature() + # macro can function as intended. As a workaround let's simply set it + # to the empty string. + # + if(DEFINED ${_feature}_${_var}) + set(${_feature}_${_var} "") + endif() endforeach() unset(${_FEATURE}_FOUND) unset(${_FEATURE}_SPLIT_CONFIGURATION) -- 2.39.5