diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2020-06-28 18:12:08 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2020-06-28 18:12:08 +0200 |
commit | aa695e6baef96797101d7b7090379e36b1279efd (patch) | |
tree | 62755226490311e9bf667c1bb257957b9c8e5f18 /cmake/CMakeMillerFuncs.cmake | |
parent | e3ceff428598a688500fdec2ce7e9e82b0b08105 (diff) |
using CMake function to clonse submodules required for cnc(master|proxy)
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'cmake/CMakeMillerFuncs.cmake')
-rw-r--r-- | cmake/CMakeMillerFuncs.cmake | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cmake/CMakeMillerFuncs.cmake b/cmake/CMakeMillerFuncs.cmake index a919904..223819b 100644 --- a/cmake/CMakeMillerFuncs.cmake +++ b/cmake/CMakeMillerFuncs.cmake @@ -83,3 +83,17 @@ function(CompileCSource source result cflags defs incl libs quiet) CHECK_C_SOURCE_COMPILES("${source}" ${result}) endfunction() +function(CloneGitSubmodule path) + find_package(Git QUIET) + option(GIT_SUBMODULE "Clone git submodules during build" ON) + if(GIT_SUBMODULE) + message(STATUS "Git Submodule update: ${GIT_EXECUTABLE} submodule update --init --recursive -- ${path}") + execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive -- "${path}" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE GIT_SUBMOD_RESULT + ERROR_QUIET OUTPUT_QUIET) + if(NOT GIT_SUBMOD_RESULT EQUAL "0") + message(FATAL_ERROR "Git Submodule update failed with ${GIT_SUBMOD_RESULT}.") + endif() + endif() +endfunction() |