1
0
mirror of synced 2024-11-12 02:00:52 +01:00

build: Make sure ImHex is being compiled with GCC 12.1.0 or higher

This commit is contained in:
WerWolv 2022-08-02 11:59:29 +02:00
parent 8a02103d5e
commit 69544bdf06
2 changed files with 14 additions and 0 deletions

View File

@ -4,6 +4,7 @@ cmake_minimum_required(VERSION 3.16)
option(IMHEX_OFFLINE_BUILD "Enable offline build" OFF)
option(IMHEX_IGNORE_BAD_CLONE "Disabled the bad clone prevention checks" OFF)
option(IMHEX_PATTERNS_PULL_MASTER "Download latest files from master branch of the ImHex-Patterns repo" OFF)
option(IMHEX_IGNORE_BAD_COMPILER "Allow compiling with an unsupported compiler" OFF)
# Basic compiler and cmake configurations
set(CMAKE_CXX_STANDARD 23)
@ -19,6 +20,7 @@ project(imhex VERSION ${IMHEX_VERSION})
# Make sure project is configured correctly
setDefaultBuiltTypeIfUnset()
detectBadClone()
verifyCompiler()
# List plugin names here. Project name must match folder name
set(PLUGINS

View File

@ -309,6 +309,18 @@ function(detectBadClone)
endforeach ()
endfunction()
set(IMHEX_REQUIRED_COMPILER "GNU")
set(IMHEX_MIN_COMPILER_VERSION "12.1.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.")
endif()
endfunction()
macro(setVariableInParent variable value)
get_directory_property(hasParent PARENT_DIRECTORY)