build: Added option for Offline builds

This commit is contained in:
WerWolv 2022-07-08 14:17:22 +02:00
parent d1a2f7d6ed
commit a57fa34f82
2 changed files with 14 additions and 10 deletions

View File

@ -10,6 +10,8 @@ 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)
# Make sure project is configured correctly
setDefaultBuiltTypeIfUnset()
detectBadClone()

View File

@ -290,6 +290,7 @@ endmacro()
function(downloadImHexPatternsFiles dest)
if (NOT IMHEX_OFFLINE_BUILD)
FetchContent_Declare(
imhex_patterns
GIT_REPOSITORY https://github.com/WerWolv/ImHex-Patterns.git
@ -301,6 +302,7 @@ function(downloadImHexPatternsFiles dest)
set(PATTERNS_FOLDERS_TO_INSTALL constants encodings includes patterns magic)
foreach (FOLDER ${PATTERNS_FOLDERS_TO_INSTALL})
install(DIRECTORY "${imhex_patterns_SOURCE_DIR}/${FOLDER}" DESTINATION ${dest})
endforeach()
endforeach ()
endif ()
endfunction()