From: Matthias Maier Date: Thu, 4 Oct 2018 16:20:13 +0000 (-0500) Subject: CMake: Use ADD_FLAGS instead of PUSH_CMAKE_REQUIRED X-Git-Tag: v9.1.0-rc1~663^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88a1c69b11af2c4fcfdb1d320e7e0ebb08a4d632;p=dealii.git CMake: Use ADD_FLAGS instead of PUSH_CMAKE_REQUIRED --- diff --git a/cmake/checks/check_01_cxx_features.cmake b/cmake/checks/check_01_cxx_features.cmake index 80387a123a..3a71a36a8a 100644 --- a/cmake/checks/check_01_cxx_features.cmake +++ b/cmake/checks/check_01_cxx_features.cmake @@ -126,8 +126,7 @@ IF(NOT DEFINED DEAL_II_WITH_CXX17 OR DEAL_II_WITH_CXX17) IF(NOT "${DEAL_II_CXX_VERSION_FLAG}" STREQUAL "") # Set CMAKE_REQUIRED_FLAGS for the unit tests MESSAGE(STATUS "Using C++ version flag \"${DEAL_II_CXX_VERSION_FLAG}\"") - PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_VERSION_FLAG}") - PUSH_CMAKE_REQUIRED("-Werror") + ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${DEAL_II_CXX_VERSION_FLAG} -Werror") UNSET_IF_CHANGED(CHECK_CXX_FEATURES_FLAGS_CXX17_SAVED "${CMAKE_REQUIRED_FLAGS}${DEAL_II_CXX_VERSION_FLAG}" @@ -241,7 +240,7 @@ IF(NOT DEFINED DEAL_II_WITH_CXX14 OR DEAL_II_WITH_CXX14) ) # Set CMAKE_REQUIRED_FLAGS for the unit tests - PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_VERSION_FLAG}") + ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${DEAL_II_CXX_VERSION_FLAG}") # # We assume std::make_unique works @@ -283,7 +282,7 @@ IF(NOT DEFINED DEAL_II_WITH_CXX14 OR DEAL_II_WITH_CXX14) # SET(_flags "${DEAL_II_CXX_FLAGS_DEBUG}") STRIP_FLAG(_flags "-Wa,--compress-debug-sections") - PUSH_CMAKE_REQUIRED("${_flags}") + ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${_flags}") CHECK_CXX_SOURCE_COMPILES( " struct foo @@ -333,7 +332,7 @@ UNSET_IF_CHANGED(CHECK_CXX_FEATURES_FLAGS_CXX11_SAVED DEAL_II_HAVE_CXX11_MACOSXC99BUG_OK ) -PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_VERSION_FLAG}") +ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${DEAL_II_CXX_VERSION_FLAG}") CHECK_CXX_SOURCE_COMPILES( " // common C++11 include files @@ -575,9 +574,7 @@ IF(DEAL_II_WITH_CXX17) ELSE() # see if the current compiler configuration supports the GCC extension # __attribute__((fallthrough)) syntax instead - PUSH_CMAKE_REQUIRED("-Werror") - PUSH_CMAKE_REQUIRED("-Wextra") - PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_VERSION_FLAG}") + ADD_FLAGS(CMAKE_REQUIRED_FLAGS "-Werror -Wextra ${DEAL_II_CXX_VERSION_FLAG}") CHECK_CXX_SOURCE_COMPILES( " int main() @@ -606,7 +603,7 @@ ELSE() ENDIF() ENDIF() -PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_VERSION_FLAG}") +ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${DEAL_II_CXX_VERSION_FLAG}") CHECK_CXX_SOURCE_COMPILES( " diff --git a/cmake/checks/check_02_compiler_features.cmake b/cmake/checks/check_02_compiler_features.cmake index 23c508cffd..984ed8ddd5 100644 --- a/cmake/checks/check_02_compiler_features.cmake +++ b/cmake/checks/check_02_compiler_features.cmake @@ -295,9 +295,8 @@ ENDIF() # "warning: use of the 'deprecated' attribute is a C++14 extension" (clang in c++11 mode) # "warning #1292: unknown attribute "deprecated"" (icc) # Hence, we treat warnings as errors: -PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_FLAGS}") -PUSH_CMAKE_REQUIRED("-Werror") -PUSH_CMAKE_REQUIRED("-Wno-unused-command-line-argument") +ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${DEAL_II_CXX_FLAGS}") +ADD_FLAGS(CMAKE_REQUIRED_FLAGS "-Werror -Wno-unused-command-line-argument") # first see if the compiler accepts the attribute CHECK_CXX_SOURCE_COMPILES( @@ -394,7 +393,7 @@ ENDIF() # # - Matthias Maier, 2015 # -PUSH_CMAKE_REQUIRED("-Werror") +ADD_FLAGS(CMAKE_REQUIRED_FLAGS "-Werror") CHECK_CXX_SOURCE_COMPILES( " _Pragma(\"GCC diagnostic push\") @@ -423,12 +422,11 @@ RESET_CMAKE_REQUIRED() # Wolfgang Bangerth, Matthias Maier, Daniel Arndt, 2015, 2018 # IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - PUSH_CMAKE_REQUIRED("-Wno-unused-command-line-argument") + ADD_FLAGS(CMAKE_REQUIRED_FLAGS "-Wno-unused-command-line-argument") ELSEIF(CMAKE_CXX_COMPILER_ID MATCHES "Intel") - PUSH_CMAKE_REQUIRED("-diag-error warn") + ADD_FLAGS(CMAKE_REQUIRED_FLAGS "-diag-error warn") ENDIF() -PUSH_CMAKE_REQUIRED("-Werror") -PUSH_CMAKE_REQUIRED("-fuse-ld=gold") +ADD_FLAGS(CMAKE_REQUIRED_FLAGS "-Werror -fuse-ld=gold") CHECK_CXX_SOURCE_COMPILES( " int main() { return 0; } diff --git a/cmake/checks/check_03_compiler_bugs.cmake b/cmake/checks/check_03_compiler_bugs.cmake index d4b70f9084..41e9ee0541 100644 --- a/cmake/checks/check_03_compiler_bugs.cmake +++ b/cmake/checks/check_03_compiler_bugs.cmake @@ -130,7 +130,7 @@ CHECK_CXX_COMPILER_BUG( # # - Wolfgang Bangerth, 2014 # -PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_FLAGS}") +ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${DEAL_II_CXX_FLAGS}") CHECK_CXX_COMPILER_BUG( " #include