diff --git a/CMakeLists.txt b/CMakeLists.txt index cfddb1061..1cabaa6d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index e50b026c9..366aba891 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -290,17 +290,19 @@ endmacro() function(downloadImHexPatternsFiles dest) - FetchContent_Declare( - imhex_patterns - GIT_REPOSITORY https://github.com/WerWolv/ImHex-Patterns.git - GIT_TAG master - ) + if (NOT IMHEX_OFFLINE_BUILD) + FetchContent_Declare( + imhex_patterns + GIT_REPOSITORY https://github.com/WerWolv/ImHex-Patterns.git + GIT_TAG master + ) - FetchContent_Populate(imhex_patterns) + FetchContent_Populate(imhex_patterns) - 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() + 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 () + endif () endfunction() \ No newline at end of file