Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: offline_mode #609

Open
sabudilovskiy opened this issue Oct 9, 2024 · 4 comments
Open

Feature request: offline_mode #609

sabudilovskiy opened this issue Oct 9, 2024 · 4 comments

Comments

@sabudilovskiy
Copy link

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.

@threeal
Copy link
Contributor

threeal commented Oct 9, 2024

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.

@sabudilovskiy
Copy link
Author

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.

@OlivierLDff
Copy link
Contributor

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

@Thaodan
Copy link

Thaodan commented Nov 1, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants