]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use -Werror again in enable_if_supported
authorDaniel Arndt <arndtd@ornl.gov>
Fri, 30 Jun 2023 20:29:48 +0000 (16:29 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Fri, 30 Jun 2023 20:29:58 +0000 (16:29 -0400)
cmake/macros/macro_enable_if_supported.cmake

index 421b4fa1f41666e10524f2ce2bbdedabd38c4d7b..b628b7a638b1f17278f873debb4d4cf97ea288cf 100644 (file)
 #
 
 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()
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.