1
0
mirror of synced 2024-11-28 01:20:51 +01:00

build: Fixed build outside of plugins

This commit is contained in:
WerWolv 2022-07-27 08:45:33 +02:00
parent 80c4949dfb
commit 438386a224
2 changed files with 14 additions and 5 deletions

View File

@ -4,17 +4,17 @@ cmake_minimum_required(VERSION 3.16)
option(IMHEX_OFFLINE_BUILD "Enable offline build" OFF) 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) 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 # Basic compiler and cmake configurations
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)
set(IMHEX_BASE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}) set(IMHEX_BASE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_MODULE_PATH "${IMHEX_BASE_FOLDER}/cmake/modules") set(CMAKE_MODULE_PATH "${IMHEX_BASE_FOLDER}/cmake/modules")
include("${IMHEX_BASE_FOLDER}/cmake/build_helpers.cmake") include("${IMHEX_BASE_FOLDER}/cmake/build_helpers.cmake")
# Setup project
loadVersion(IMHEX_VERSION)
setVariableInParent(IMHEX_VERSION ${IMHEX_VERSION})
project(imhex VERSION ${IMHEX_VERSION})
# Make sure project is configured correctly # Make sure project is configured correctly
setDefaultBuiltTypeIfUnset() setDefaultBuiltTypeIfUnset()
detectBadClone() detectBadClone()

View File

@ -293,6 +293,15 @@ macro(detectBadClone)
endforeach () endforeach ()
endmacro() endmacro()
macro(setVariableInParent variable value)
get_directory_property(hasParent PARENT_DIRECTORY)
if (hasParent)
set(${variable} "${${value}}" PARENT_SCOPE)
else ()
set(${variable} "${value}")
endif ()
endmacro()
function(downloadImHexPatternsFiles dest) function(downloadImHexPatternsFiles dest)
if (NOT IMHEX_OFFLINE_BUILD) if (NOT IMHEX_OFFLINE_BUILD)