build: Added check for cloning ImHex without initializing its submodules

This commit is contained in:
WerWolv 2021-12-17 08:38:25 +01:00
parent 891cc42f08
commit b22774e33d
2 changed files with 12 additions and 0 deletions

View File

@ -8,6 +8,7 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules") set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
include("${CMAKE_SOURCE_DIR}/cmake/build_helpers.cmake") include("${CMAKE_SOURCE_DIR}/cmake/build_helpers.cmake")
setDefaultBuiltTypeIfUnset() setDefaultBuiltTypeIfUnset()
detectBadClone()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
# List plugin names here. Project name must match folder name # List plugin names here. Project name must match folder name

View File

@ -256,4 +256,15 @@ macro(setDefaultBuiltTypeIfUnset)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Using Release build type as it was left unset" FORCE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Using Release build type as it was left unset" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release") set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
endif() endif()
endmacro()
macro(detectBadClone)
file (GLOB EXTERNAL_DIRS "external/*")
foreach (EXTERNAL_DIR ${EXTERNAL_DIRS})
file(GLOB RESULT "${EXTERNAL_DIR}/*")
list(LENGTH RESULT ENTRY_COUNT)
if(ENTRY_COUNT LESS_EQUAL 1)
message(FATAL_ERROR "External dependency ${EXTERNAL_DIR} is empty!\nMake sure to correctly clone ImHex using the --recurse-submodules git option or initialize the submodules manually.")
endif()
endforeach ()
endmacro() endmacro()