From: Matthias Maier Date: Fri, 22 May 2020 04:39:05 +0000 (-0500) Subject: CMake: help some old compilers with C++14 support X-Git-Tag: v9.3.0-rc1~1575^2~9 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fac7b5348bfdd3a5632b224d2889e1068d7cbb61;p=dealii.git CMake: help some old compilers with C++14 support --- diff --git a/cmake/checks/check_01_cxx_features.cmake b/cmake/checks/check_01_cxx_features.cmake index c5828aea42..e41f309925 100644 --- a/cmake/checks/check_01_cxx_features.cmake +++ b/cmake/checks/check_01_cxx_features.cmake @@ -33,6 +33,20 @@ # # ######################################################################## +# +# Some old compiler versions default to C++98/03 rather than C++14. Inject +# -std=c++14 into the compiler flags in this case. +# +IF((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" + AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.1") + OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" + AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0") + OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" + AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10.0")) + MESSAGE(STATUS "Old compiler detected, setting -std=c++14") + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-std=c++14") +ENDIF() + # # Use compile flags specified in ${DEAL_II_CXX_FLAGS} for the following # tests: