From: Matthias Maier Date: Sat, 26 Nov 2022 23:23:56 +0000 (-0600) Subject: CMake: bugfix: make sure that cached feature variables do not interfere X-Git-Tag: v9.5.0-rc1~797^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=182aa6b67762a0702291181d9d47cae1a239a96f;p=dealii.git CMake: bugfix: make sure that cached feature variables do not interfere --- 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)