Comments (10)
Yeah I was thinking about something like that, though there could be issues with the Path's name and length if simply appended. Perhaps .cache/CPM/{lowercase name}/{SHA1 Hash of all origin parameters}
would work.
from cpm.cmake.
Awesome, thanks!
I've also been testing this for the last days and it works quite well. Some small issues occurred when updating dependencies or clearing the cache, but those should be resolved by now.
I agree, we should rename the var to CPM_SOURCE_CACHE
.
from cpm.cmake.
It should be possible to read in an environmental environment and set the value, if it exists. However I believe sharing downloads could easily break if different projects use different versions/sources of the same dependency.
We should investigate this first before endorsing a global download location. Perhaps it's possible to safely encode the version/source information in the download path?
Also note that only the download itself and not the build can be cached, as builds would break when different options or generators are used. For faster builds I recommend checking out caching compiler wrappers such as sccache.
from cpm.cmake.
I use ccache already. It is more about caching the downloads, the version should be in then path name then. If everything is found in the cache then no online connection would be required. I wonder if this is out of scope for CPM. So the cache contains all downloads like this named by CPM params already required?
.cache/CPM/{NAME}-{URL}-{VERSION}
from cpm.cmake.
I've implemented the above suggestion here: CPM.cmake. CPM should now check for the environmental variable CPM_SOURCE_ROOT
which should be set to the absolute path of the download directory.
@aggsol It would be great if you could check if that works for your projects and solves your use-case.
from cpm.cmake.
So I just did a simple test and it seems that CMake actually removes the source directories before trying to repopulate them. That kinda makes the whole concept of caching downloads obsolete. I'll investigate if we can change this behaviour.
from cpm.cmake.
I've updated the source to override the download step if the directory already exists: CPM.cmake. Could you check if it works for you now @aggsol ?
from cpm.cmake.
@TheLartians I will give it a go, please gimme some days. Currently busy T_T
from cpm.cmake.
Thanks! NP, I just want to make sure itβs battle tested before publishing as this seems to be a big feature.
from cpm.cmake.
I tested it in two different systems with environment variable and as command line parameter. Different builds and different versions of libraries. I used $HOME/.cache/CPM
for both and checked creation of folders and files. This works really good! Maybe the var should be renamed CPM_SOURCE_CACHE
then? I will check how it behaves in the following weeks.
from cpm.cmake.
Related Issues (20)
- CPMFindPackage failed to find package installed by apt on Debian HOT 4
- how to pass cmake configure param HOT 1
- CPM call to FetchContent_Populate freezes build sequence HOT 2
- parsing error HOT 9
- CPM on monorepos HOT 1
- Pick up version from tarball name NAME-VERSION.tar.xz
- add_library() isn't aware of h-file location like add_executable() HOT 1
- GIT_SHALLOW still downloads the whole repo HOT 1
- CPM in CMake scripts: define_property command is not scriptable
- CPM_SOURCE_CACHE is ignored if SOURCE_DIR is set
- Can you help with compiling `libtins` library using CPM?
- cpm git fetch is occasionally empty HOT 1
- Cache: failure when the download is aborted and the download dir is empty HOT 3
- Add support for ExternalProject_Add() / libjpeg HOT 3
- Feature Request: Short syntax in long syntax. HOT 1
- Don't unconditionally download in get_cpm.cmake HOT 5
- Add example for using the `libuv` repository HOT 2
- CPM name of the package MUST NOT be exported target name HOT 2
- Using CPM_dep_SOURCE appears to work, but includes are not found HOT 4
- when use cache the depends lib appeared outside the project in clion HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpm.cmake.