From df28f970fa05950c35d726fb11752796a23b5108 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 13 Feb 2016 11:40:24 +0100 Subject: [PATCH] CMake: Fix submodule init --- cmake/common/px4_base.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 71b81c68f9..82e417f48f 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -138,13 +138,15 @@ function(px4_add_git_submodule) string(REPLACE "/" "_" NAME ${PATH}) add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git_init_${NAME}.stamp WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND git submodule init ${PATH} + COMMAND git submodule update --init --recursive ${PATH} COMMAND touch ${CMAKE_BINARY_DIR}/git_init_${NAME}.stamp DEPENDS ${CMAKE_SOURCE_DIR}/.gitmodules ) add_custom_target(${TARGET} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND git submodule update --recursive ${PATH} +# This is NOT a good approach as it overwrites checked out branches +# behind the back of a developer + #COMMAND git submodule update --recursive ${PATH} DEPENDS ${CMAKE_BINARY_DIR}/git_init_${NAME}.stamp ) endfunction()