Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cache source code fetched via CMake FetchContent in GitHub Actions

I've got a CMake-based project in which I heavily rely on FetchContent to retrive multiple libraries (source code). Downloading all the libraries may take time which I want to save when compiling on a CI runner (GitHub Actions).

I saw there's a cache action, how I can use that to cache the fetched source code?

As a bonus, It might be helpful to cache the compiled code of these fetched libraries as well. It that possible somehow?

like image 884
galah92 Avatar asked Aug 15 '26 04:08

galah92


1 Answers

CMake doesn't provide any such functionality.

For that reason I have developed my own solution at https://github.com/jjYBdx4IL/dlcache.

What you need to do is to replace the URL parameters with local file paths of the locally cached files. That's what https://github.com/jjYBdx4IL/dlcache-cmake is providing.

like image 83
user1050755 Avatar answered Aug 19 '26 02:08

user1050755