1
0
mirror of synced 2024-11-24 07:40:17 +01:00

build: Cleanup version loading logic to make it available for plugins

This commit is contained in:
WerWolv 2022-07-27 08:27:38 +02:00
parent 54b31b8a55
commit 80c4949dfb
2 changed files with 14 additions and 7 deletions

View File

@ -1,18 +1,20 @@
cmake_minimum_required(VERSION 3.16)
# Updating the version here will update it throughout ImHex as well
file(READ "VERSION" IMHEX_VERSION)
project(imhex VERSION ${IMHEX_VERSION})
message("Project version ${IMHEX_VERSION}")
# Options
option(IMHEX_OFFLINE_BUILD "Enable offline build" OFF)
option(IMHEX_PATTERNS_PULL_MASTER "Download latest files from master branch of the ImHex-Patterns repo" OFF)
# Setup project
loadVersion(IMHEX_VERSION)
set(IMHEX_VERSION ${IMHEX_VERSION} PARENT_SCOPE)
project(imhex VERSION ${IMHEX_VERSION})
# Basic compiler and cmake configurations
set(CMAKE_CXX_STANDARD 23)
set(IMHEX_BASE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_MODULE_PATH "${IMHEX_BASE_FOLDER}/cmake/modules")
include("${IMHEX_BASE_FOLDER}/cmake/build_helpers.cmake")
option(IMHEX_OFFLINE_BUILD "Enable offline build" OFF)
option(IMHEX_PATTERNS_PULL_MASTER "Download latest files from master branch of the ImHex-Patterns repo" OFF)
# Make sure project is configured correctly
setDefaultBuiltTypeIfUnset()
detectBadClone()

View File

@ -277,6 +277,11 @@ macro(setDefaultBuiltTypeIfUnset)
endif()
endmacro()
function(loadVersion version)
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" read_version)
set(${version} ${read_version} PARENT_SCOPE)
endfunction()
macro(detectBadClone)
file (GLOB EXTERNAL_DIRS "lib/external/*")
foreach (EXTERNAL_DIR ${EXTERNAL_DIRS})