diff --git a/README.md b/README.md index a8214c7..8a585a6 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ Every programming language and framework has its own way of caching. See [Examples](examples.md) for a list of `actions/cache` implementations for use with: +- [C++ - CPM.cmake](./examples.md#c---cpm.cmake) - [C# - Nuget](./examples.md#c---nuget) - [D - DUB](./examples.md#d---dub) - [Elixir - Mix](./examples.md#elixir---mix) diff --git a/examples.md b/examples.md index c66eca6..abea74d 100644 --- a/examples.md +++ b/examples.md @@ -1,6 +1,7 @@ # Examples - [Examples](#examples) + - [C++ - CPM.cmake](#c---cpm.cmake) - [C# - NuGet](#c---nuget) - [D - DUB](#d---dub) - [Elixir - Mix](#elixir---mix) @@ -32,6 +33,29 @@ - [Swift, Objective-C - CocoaPods](#swift-objective-c---cocoapods) - [Swift - Swift Package Manager](#swift---swift-package-manager) +## C++ - CPM.cmake + +Using [CPM.cmake](https://github.com/TheLartians/CPM.cmake): + +```yaml +- name: Set up cache + id: cache-cpm + uses: actions/cache@v2 + with: + path: ~/cpm-cache + key: ${{ runner.os }}-cpm-${{ hashFiles('**/') }} + restore-keys: | + ${{ runner.os }}-cpm- + +- name: Build CMake + run: | + mkdir build && cd build + cmake -DCPM_SOURCE_CACHE=~/cpm-cache .. + make -j2 +``` + +Pass `CPM_SOURCE_CACHE` to CMake as `-DCPM_SOURCE_CACHE=`. + ## C# - NuGet Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):