Ad

How To Fix Git Submodule Update --init --recursive Not Pulling CMakeLists.txt?

- 1 answer

I have a project with several git submodules. I have CMakeLists.txt for each submodule and for the main project. When I git clone the main project, git pulls the main CMakeLists.txt. However when I do git submodule update --init --recursive, git pulls all the submodules, except the CMakeLists.txt in each submodule. Cloning the submodules invidually works properly. How do I fix this?

project/
  - CMakeLists.txt
  - src/
    - main.cpp
  - lib/
    - CMakeLists.txt
    - moduleA/
        -CMakeLists.txt
        - fooA.cpp
        - fooA.h
        - barA.cpp
        - barA.h
    - moduleB/
        - CMakeLists.txt
        - fooB.cpp
        - fooB.h
Ad

Answer

While re-cloning everything will work, updating should have worked too.

Maybe those files were introduced in a more recent version of those submodules:

git submodule update --remote --recursive

That would fetch the latest of those submodules (master by default)

Ad
source: stackoverflow.com
Ad