cpm-cmake / CPM.cmake

📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GIT_SHALLOW still downloads the whole repo

Leafmun-certii opened this issue · comments

I am using CPMAddPackage to download a repo at a tag containing a lot less than the main branch. I have specified GIT_SHALLOW, however, this downloads the whole repo before switching to the tag I need.

Is there any way to just download the files specified at the tag? This might be an issue with CMake's Fetch Content but I thought I'd ask here as well just in case anyone has any bright ideas.

Thanks all!

@Leafmun-certii Yes this is a common issue. You may want to use GIT_TAG (with hash of the stable commit) instead.

Or even better (for smaller downloads) use github archive URL with your target tag. See example:

CPMAddPackage(
  NAME     spdlog
  URL      https://github.com/gabime/spdlog/archive/refs/tags/v1.12.0.zip
  DOWNLOAD_EXTRACT_TIMESTAMP TRUE
)