IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION)
#
- # Take care that the following tests are rerun if CMAKE_REQUIRED_FLAGS
- # changes..
+ # Take care that the following tests are rerun if the
+ # CMAKE_REQUIRED_FLAGS changes..
#
- IF(NOT "${CMAKE_REQUIRED_FLAGS}" STREQUAL "${DEAL_II_CHECK_CPU_FEATURES_SAVED}")
- UNSET(DEAL_II_HAVE_SSE2 CACHE)
- UNSET(DEAL_II_HAVE_AVX CACHE)
- UNSET(DEAL_II_HAVE_AVX512 CACHE)
- ENDIF()
- SET(DEAL_II_CHECK_CPU_FEATURES_SAVED
- "${CMAKE_REQUIRED_FLAGS}" CACHE INTERNAL "" FORCE
+ UNSET_IF_CHANGED(CHECK_CPU_FEATURES_FLAGS_SAVED "${CMAKE_REQUIRED_FLAGS}"
+ DEAL_II_HAVE_SSE2 DEAL_II_HAVE_AVX DEAL_II_HAVE_AVX512
)
CHECK_CXX_SOURCE_RUNS(
# #
########################################################################
+UNSET_IF_CHANGED(CHECK_CXX_FEATURES_FLAGS_SAVED
+ "${CMAKE_REQUIRED_FLAGS}${DEAL_II_CXX_VERSION_FLAG}${DEAL_II_WITH_CXX14}${DEAL_II_WITH_CXX17}"
+ DEAL_II_HAVE_ATTRIBUTE_FALLTHROUGH
+ DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE
+ DEAL_II_HAVE_FP_EXCEPTIONS
+ DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS
+ )
+
#
# Try to enable a fallthrough attribute. This is a language feature in C++17,
# but a compiler extension in earlier language versions: check both
# DEAL_II_COMPILER_HAS_FUSE_LD_GOLD
#
+#
+# A couple of test results depend on compiler flags and the C++ mode. Rerun
+# these tests if necessary
+#
+
+UNSET_IF_CHANGED(CHECK_CXX_FEATURES_FLAGS_SAVED
+ "${CMAKE_REQUIRED_FLAGS}${DEAL_II_CXX_VERSION_FLAG}${DEAL_II_WITH_CXX14}${DEAL_II_WITH_CXX17}"
+ DEAL_II_COMPILER_HAS_CXX14_ATTRIBUTE_DEPRECATED
+ DEAL_II_COMPILER_HAS_ATTRIBUTE_DEPRECATED
+ )
+
#
# Check whether the compiler allows to use arithmetic operations
--- /dev/null
+## ---------------------------------------------------------------------
+##
+## Copyright (C) 2018 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, redistribute
+## it, and/or modify it under the terms of the GNU Lesser General
+## Public License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE at
+## the top level of the deal.II distribution.
+##
+## ---------------------------------------------------------------------
+
+#
+# Usage:
+# UNSET_IF_CHANGED(<internal variable> "string"
+# [cached variable names]
+# )
+#
+# This macro caches the supplied "string" internally in ${<internal
+# variable>} and unsets all supplied (cached) variables if this string
+# changes.
+#
+MACRO(UNSET_IF_CHANGED _variable _string)
+ IF(DEFINED ${_variable})
+ IF(NOT "${${_variable}}" STREQUAL "${_string}")
+ FOREACH(_arg ${ARGN})
+ MESSAGE(STATUS
+ "Configuration changed. Unsetting cached variable \"${_arg}\" and rerunning checks.")
+ UNSET(${_arg} CACHE)
+ ENDFOREACH()
+ ENDIF()
+ ENDIF()
+ SET(${_variable} "${_string}" CACHE INTERNAL "" FORCE)
+ENDMACRO()