]> https://gitweb.dealii.org/ - dealii.git/commitdiff
make MSVC happy
authorMatthias Maier <tamiko@43-1.org>
Fri, 22 May 2020 17:53:42 +0000 (12:53 -0500)
committerMatthias Maier <tamiko@43-1.org>
Sat, 23 May 2020 14:59:23 +0000 (09:59 -0500)
cmake/checks/check_01_cxx_features.cmake

index 68aeb2696a58f202a20ad143ddc36e24b78af158..fd4f6c498b6489a500f00647ce69cd9be742891c 100644 (file)
 # tests. Create a small macro to easily set CMAKE_REQUIRED_FLAGS
 #
 MACRO(_set_up_cmake_required)
-  RESET_CMAKE_REQUIRED()
-  SET(CMAKE_REQUIRED_FLAGS "")
-
-  IF(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
-    SET(_werror_flag "/WX")
-  ELSE()
-    SET(_werror_flag "-Werror")
-  ENDIF()
-
-  ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${DEAL_II_CXX_FLAGS} ${_werror_flag}")
-  ENABLE_IF_SUPPORTED(CMAKE_REQUIRED_FLAGS "-Wno-unused-command-line-argument")
-
   # Let's put the user supplied `DEAL_II_CXX_FLAGS_SAVED` last so that we
   # never override a user supplied -std=c++XY flag in our tests.
+  RESET_CMAKE_REQUIRED()
+  SET(CMAKE_REQUIRED_FLAGS "")
+  ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${DEAL_II_CXX_FLAGS}")
   ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${DEAL_II_CXX_FLAGS_SAVED}")
 ENDMACRO()
 
@@ -291,6 +282,18 @@ _test_cxx17_support()
 ########################################################################
 
 
+#
+# In the following we have to avoid
+#
+SET(_werror_flag "")
+IF(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
+  ENABLE_IF_SUPPORTED(_werror_flag "/WX /EHsc")
+ELSE()
+  ENABLE_IF_SUPPORTED(_werror_flag "-Werror")
+  ENABLE_IF_SUPPORTED(_werror_flag "-Wno-unused-command-line-argument")
+ENDIF()
+ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${_werror_flag}")
+
 UNSET_IF_CHANGED(CHECK_CXX_FEATURES_FLAGS_SAVED
   "${CMAKE_REQUIRED_FLAGS}"
   DEAL_II_HAVE_FP_EXCEPTIONS

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.