1

I need to write a script to clone Boost library, but the repository is unfortunately really big and I need to use just some submodules afterwards. I'd like to store them in one string variable like this

set(MODULES tools/build libs/system)

and then pass the variable in to one command like this

git clone --recurse-submodules=${MODULES} https://github.com/boostorg/boost.git

The problem is, that after passing multiple arguments into --recurse-submodules, all of them get ignored.

I had a look at How to only update specific git submodules?, but the answers cover only cloning of one submodules or repeating --recurse-submodules multiple times, which I don't like to, as I want to make the script prepared for arbitrary number of submodules.

Is there any way how to achieve that with Git and CMake? I'd like to stay there for my code to remain multiplatform.

I know, how to do that using Bash, but I have no idea, if something similar is possible in CMake.

Eenoku
  • 2,741
  • 4
  • 32
  • 64
  • "as I want to make the script prepared for arbitrary number of submodules." - You may iterate over `MODULES` list and issue an appropriate command for one submodule in each iteration. The question seems not about CMake: it `git` supports for cloning multiple submodules at once, you need to get this command first. Otherwise you need to resort on iterating on modules. – Tsyvarev Apr 01 '19 at 15:26

0 Answers0