build: Added support for Clang 14.0.0+

This commit is contained in:
WerWolv 2022-08-07 23:12:10 +02:00
parent 738a537723
commit 1aa497cb7b
1 changed files with 6 additions and 3 deletions

View File

@ -324,15 +324,18 @@ function(detectBadClone)
endforeach ()
endfunction()
set(IMHEX_REQUIRED_COMPILER "GNU")
set(IMHEX_MIN_COMPILER_VERSION "12.0.0")
function(verifyCompiler)
if (IMHEX_IGNORE_BAD_COMPILER)
return()
endif()
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL ${IMHEX_REQUIRED_COMPILER} OR CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${IMHEX_MIN_COMPILER_VERSION})
message(FATAL_ERROR "ImHex requires GCC ${IMHEX_MIN_COMPILER_VERSION} or newer. Please use the latest GCC version.")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0.0")
message(FATAL_ERROR "ImHex requires GCC 12.0.0 or newer. Please use the latest GCC version.")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "14.0.0")
message(FATAL_ERROR "ImHex requires Clang 14.0.0 or newer. Please use the latest Clang version.")
elseif (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message(FATAL_ERROR "ImHex can only be compiled with GCC or Clang. ${CMAKE_CXX_COMPILER_ID} is not supported.")
endif()
endfunction()