cpm-cmake / CPM.cmake

📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.
MIT License
2.85k stars 181 forks source link

Shallow submodules #573

Open artiomn opened 1 month ago

artiomn commented 1 month ago

Some projects that project depends on may have a large number of submodules. Can CPM clone these projects without history or with a history depth limitation for all submodules?

I.e.: https://stackoverflow.com/a/17692710/7883447

Is it possible?

This will probably have a good effect on increasing build speed.

Avus-c commented 1 month ago

CPM itself does not handle the download/clone operation. This task is performed by CMake's FetchContent module.

You can add GIT_SHALLOW TRUE to the CPMAddPackage call, although I am unsure if this setting is forwarded when cloning submodules. Other than that, there isn't much we can do.

For more options related to git, you can take a look here. I only took a quick look, but haven't found anything that could help.

On a sidenote: Any argument that isn't part of the CPMAddPackage signature is forwarded to FetchContent_*. (We should probably document this somewhere if it isn't : ) )