Open sabudilovskiy opened 1 month ago
i believe you can just copy paste the CPM_SOURCE_CACHE
and it should work in offline mode as long as you didn't update the dependency.
i believe you can just copy paste the
CPM_SOURCE_CACHE
and it should work in offline mode as long as you didn't update the dependency.
Still, this is not quite it, because instead of archives/repositories and so on, you have to store the internal representation of FetchContent. I don't really understand how everything is arranged, but can't Fetch Content politely ask to download artifacts somewhere? Let's say some boost is downloaded by an archive, we would like to have it in the repository by the same archive.
Just make CPM_SOURCE_CACHE
to some .cpm
value. Like that you have a folder in your repo with all the downloaded dependency in a subfolder of your repo.
For example: .cpm/boost/somehashthatdefineyourversion
Is that really enough? Ideally there would be some kind of integration to automate this. To me it just seems like bad design to just mid build download some sources on top of the upstream's pristine sources.
If you could for example integrate better with git by using submodules for sources then the whole issue regarding the offline mode would be solved as sources would be fetched and always up to date assuming the sources checked out were not modified.
EDIT: Is it possible to set FETCHCONTENT_TRY_FIND_PACKAGE_MODE to NEVER as suggested by the CMake docs when using FetchContent with find_package?
I would like to use CPM in enterprise development.
For this purpose, it would be convenient if, in addition to CPM_SOURCE_CACHE, there was an option to define a folder to which artifacts are downloaded (initial, i.e. there is a zip archive, or a clone of the repository is performed, etc.), as well as an option to prohibit attempts to download anything. If such an option already exists, I would be glad to know, because I have the impression that there is no such thing.