Skip to content

Commit

Permalink
build: Make sure ImHex is being compiled with GCC 12.1.0 or higher
Browse files Browse the repository at this point in the history
  • Loading branch information
WerWolv committed Aug 2, 2022
1 parent 8a02103 commit 69544bd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
12 changes: 12 additions & 0 deletions cmake/build_helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 69544bd

Please sign in to comment.