cpm-cmake / CPM.cmake

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

Can't match git version warning #487

Open hsdk123 opened 1 year ago

hsdk123 commented 1 year ago

Hi, I notice that for some repos I get the following warning when using CPM. (doesn't happen when using fetchcontent)

Would anyone notice what's happening?

 CMake Warning at C:/Users/daego/Desktop/Projects/Light.vn-core/_deps/magnum/88cbd2f51eb19313126eee0f666a5c951718675c/src/Magnum/CMakeLists.txt:68 (message):
  Can't match Git version: fatal: No tags can describe
  'e509f02da8bb734ff1a54d581d43630f84599a27'.

  Try --always, or create some tags.

Repo mentioned: https://github.com/mosra/magnum

Usage

CPMAddPackage(
  magnum
  GIT_REPOSITORY https://github.com/mosra/magnum.git
  GIT_TAG        master
  SYSTEM
)
tanja84dk commented 1 year ago

I believe its because you are using the branch ( master in your situation ) as tag and it proberbly has updated since so the hashes doesn't match up ( actually just noticed your commit hash in the folder names and git error says 404 so probably deleted )

Also I believe fetch content does not use caching if I remember correctly ( but may be wrong ), so I believe that is the reason you dont see the error with it.

It does also state in the readme under Usage for CPM that it isn't recommended since CPM is using caching

GIT_TAG can also be set to a specific commit or a branch name such as master, however this isn't recommended, as such packages will only be updated when the cache is cleared.

So short I think its because of the caching that you now have part of something there don't exist anymore