]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: help some old compilers with C++14 support
authorMatthias Maier <tamiko@43-1.org>
Fri, 22 May 2020 04:39:05 +0000 (23:39 -0500)
committerMatthias Maier <tamiko@43-1.org>
Sat, 23 May 2020 14:56:50 +0000 (09:56 -0500)
cmake/checks/check_01_cxx_features.cmake

index c5828aea42398fb109ba9d3b279ff45bfaba9aa4..e41f3099256911fc400bafcdaa98cffdfee33f70 100644 (file)
 #                                                                      #
 ########################################################################
 
+#
+# 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:

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.