From ac7ee0e959331956681aabcc51722f1f44ae6995 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Thu, 23 Apr 2020 15:32:34 -0400 Subject: [PATCH] Check for GCC7 for implicit-fallthrough support --- desktop_version/CMakeLists.txt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/desktop_version/CMakeLists.txt b/desktop_version/CMakeLists.txt index e1b64fa9..93e248da 100644 --- a/desktop_version/CMakeLists.txt +++ b/desktop_version/CMakeLists.txt @@ -150,7 +150,20 @@ ELSEIF(CUSTOM_LEVEL_SUPPORT STREQUAL "DISABLED") ADD_DEFINITIONS(-DNO_CUSTOM_LEVELS -DNO_EDITOR) ENDIF() -IF (NOT MSVC) +IF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + SET(SUPPORTS_IMPLICIT_FALLTHROUGH 1) +ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + IF(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0) + SET(SUPPORTS_IMPLICIT_FALLTHROUGH 1) + ELSE() + SET(SUPPORTS_IMPLICIT_FALLTHROUGH 0) + ENDIF() +ELSE() + SET(SUPPORTS_IMPLICIT_FALLTHROUGH 0) +ENDIF() + + +IF(SUPPORTS_IMPLICIT_FALLTHROUGH) TARGET_COMPILE_OPTIONS(VVVVVV PRIVATE -Werror=implicit-fallthrough) ENDIF()