]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Use ADD_FLAGS instead of PUSH_CMAKE_REQUIRED
authorMatthias Maier <tamiko@43-1.org>
Thu, 4 Oct 2018 16:20:13 +0000 (11:20 -0500)
committerMatthias Maier <tamiko@43-1.org>
Thu, 4 Oct 2018 16:20:13 +0000 (11:20 -0500)
cmake/checks/check_01_cxx_features.cmake
cmake/checks/check_02_compiler_features.cmake
cmake/checks/check_03_compiler_bugs.cmake

index 80387a123af9ce6bc36670de84a3f872bb493da4..3a71a36a8a2008f9f1428feb9abdca9a2ca7df20 100644 (file)
@@ -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(
   "
index 23c508cffda4811cd64cb2556a7ddf794371eb00..984ed8ddd5dfe5a244a84cd0347cb6befba7f93d 100644 (file)
@@ -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; }
index d4b70f9084dfe6089c27168ce168c09d70bad258..41e9ee0541c211bf70d85581fb60137063a48ca2 100644 (file)
@@ -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 <functional>

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.