How to parallelize git submodules

We are trying to build boost using cmake (this works and is not the issue). The challenge is the time it takes to clone the submodules. It appears git supports fetchJobs which can allow this to be parallelized. By default it looks to only run 1 job at a time. How can one either set/ensure the git config with this parameter is used or pass --jobs to the git command used in FetchContent

NOTE: this comment does not generally apply for Git submodules.

The git clone --jobs would be the likely option to help Git clone with Git submodules.


In general, for ExternalProject or FetchContent with a huge Git repo I use the project’s source archive URL if available. Benchmark of URL vs. GIT_REPOSITORY shows more than 10x speedup possible with URL archive.

While I appreciate the suggestion, it does not address the question. Additionally, and I would have to check again but boost did/does not provide a compatible release archive so that method may not be a viable option here.

At first glance since Git config can set fetchParallel

Git submodule in parallel might be something the ExternalProject GIT_CONFIG could do.

Is this the top-level repo you’re using for Boost?

https://github.com/boostorg/boost

That works thank you. I knew there had to be a config parameter but could not seem to find it when looking (probably scrolled past it a dozen times)

Great! What GIT_CONFIG worked for you? I can add it to ExternalProject CMake docs