]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Fail gracefully on ancient compilers (#702)
authorAlexander Lanin <alex@lanin.de>
Fri, 23 Oct 2020 13:30:54 +0000 (15:30 +0200)
committerGitHub <noreply@github.com>
Fri, 23 Oct 2020 13:30:54 +0000 (15:30 +0200)
CMakeLists.txt

index 77fbd2ccc72b61e3e524b2a61c32f016f4ddcde4..ebecf441a78287d21f4124de68dbedac9adf2369 100644 (file)
@@ -16,6 +16,29 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
 
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
 
+#
+#
+# Minimum compiler requirements
+# (Fail gracefully instead of cryptic C++ error messages)
+#
+#
+
+# Clang 3.4 and AppleClang 6.0 do not compile doctest.
+# Gcc 4.8.5 has been the minimum version for quite a while.
+if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)
+OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8.5)
+OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0))
+  message(FATAL_ERROR "The compiler you are using is too old, sorry.\nYou need one listed here: https://ccache.dev/platform-compiler-language-support.html")
+endif()
+
+# All Clang problems / special handling ccache has is because of 3.5.
+# All gcc problems / special handling ccache has is because of 4.8.5.
+if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6)
+OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0))
+  message(WARNING "The compiler you are using is rather old.\nIf anything goes wrong you might be better of with one listed here: https://ccache.dev/platform-compiler-language-support.html")
+endif()
+
+
 #
 # Settings
 #