2022-08-14 22:08:06 +00:00
|
|
|
################################################################################
|
|
|
|
## Author: Shaun Reed | Contact: shaunrd0@gmail.com | URL: www.shaunreed.com ##
|
|
|
|
## ##
|
|
|
|
## CMake function to update git submodules ##
|
|
|
|
################################################################################
|
|
|
|
include_guard()
|
|
|
|
|
|
|
|
find_package(Git)
|
|
|
|
|
|
|
|
# _PATH: Path to git submodule location that we want to update
|
|
|
|
# + submodule_update(extern/assimp)
|
|
|
|
function(submodule_update _PATH)
|
2022-08-21 19:37:42 +00:00
|
|
|
if (NOT QTK_UPDATE_SUBMODULES)
|
2022-08-14 22:08:06 +00:00
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT GIT_FOUND)
|
2022-08-14 22:17:05 +00:00
|
|
|
message(FATAL_ERROR "[Qtk] Error: No git executable found")
|
2022-08-14 22:08:06 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
execute_process(
|
2022-08-21 19:37:42 +00:00
|
|
|
COMMAND ${GIT_EXECUTABLE} submodule update --init --force "${_PATH}"
|
|
|
|
RESULT_VARIABLE result
|
2022-08-14 22:08:06 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
if (NOT result EQUAL 0)
|
2022-08-21 19:37:42 +00:00
|
|
|
message(
|
|
|
|
FATAL_ERROR
|
|
|
|
"[Qtk] Error: Unable to update git submodule at ${_PATH}"
|
|
|
|
)
|
2022-08-14 22:08:06 +00:00
|
|
|
endif()
|
|
|
|
endfunction()
|