cmake to do a git submodule update
This commit is contained in:
parent
57f8c216b5
commit
c28b1ee6bd
@ -1,3 +1,19 @@
|
||||
# Adapted https://cliutils.gitlab.io/modern-cmake/chapters/projects/submodule.html
|
||||
find_package(Git QUIET)
|
||||
if(GIT_FOUND AND EXISTS ".gitmodules")
|
||||
# Update submodules as needed
|
||||
option(GIT_SUBMODULE "Check submodules during build" ON)
|
||||
if(GIT_SUBMODULE)
|
||||
message(STATUS "Submodule update")
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
RESULT_VARIABLE GIT_SUBMOD_RESULT)
|
||||
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
|
||||
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_dependencies(nextpnr-${family} torc)
|
||||
add_custom_target(torc ALL
|
||||
COMMAND $(MAKE) > /dev/null 2> /dev/null
|
||||
|
Loading…
Reference in New Issue
Block a user