From: Daniel Arndt Date: Fri, 30 Jun 2023 20:29:48 +0000 (-0400) Subject: Use -Werror again in enable_if_supported X-Git-Tag: relicensing~823^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7699f518e5f17f07f5fefe033a7322f80f901a41;p=dealii.git Use -Werror again in enable_if_supported --- diff --git a/cmake/macros/macro_enable_if_supported.cmake b/cmake/macros/macro_enable_if_supported.cmake index 421b4fa1f4..b628b7a638 100644 --- a/cmake/macros/macro_enable_if_supported.cmake +++ b/cmake/macros/macro_enable_if_supported.cmake @@ -22,8 +22,15 @@ # macro(enable_if_supported _variable _flag) + # First check if we can use -Werror + CHECK_CXX_COMPILER_FLAG("-Werror" DEAL_II_HAVE_FLAG_werror) + string(STRIP "${_flag}" _flag_stripped) + if(DEAL_II_HAVE_FLAG_werror) + set(CMAKE_REQUIRED_FLAGS "-Werror") + endif() + # # Gcc does not emit a warning if testing -Wno-... flags which leads to # false positive detection. Unfortunately it later warns that an unknown @@ -47,5 +54,7 @@ macro(enable_if_supported _variable _flag) string(STRIP "${${_variable}}" ${_variable}) endif() endif() + + unset(CMAKE_REQUIRED_FLAGS) endmacro()