From: Matthias Maier Date: Fri, 22 May 2020 17:53:42 +0000 (-0500) Subject: make MSVC happy X-Git-Tag: v9.3.0-rc1~1575^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ece82a4ed6ce8d66f0f5c33c0cff5b1a0d4b91e2;p=dealii.git make MSVC happy --- diff --git a/cmake/checks/check_01_cxx_features.cmake b/cmake/checks/check_01_cxx_features.cmake index 68aeb2696a..fd4f6c498b 100644 --- a/cmake/checks/check_01_cxx_features.cmake +++ b/cmake/checks/check_01_cxx_features.cmake @@ -41,20 +41,11 @@ # 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