Implemented C++ with CPM.cmake example

This commit is contained in:
Leonardo Lima 2020-10-05 06:03:08 -03:00
parent d606e039ae
commit 59fff6f49c
2 changed files with 25 additions and 0 deletions

View file

@ -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)

View file

@ -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=<path to cache directory>`.
## C# - NuGet
Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):