mirror of
				https://github.com/actions/cache.git
				synced 2025-11-04 01:24:02 +00:00 
			
		
		
		
	Implemented C++ with CPM.cmake example
This commit is contained in:
		
							parent
							
								
									d606e039ae
								
							
						
					
					
						commit
						59fff6f49c
					
				@ -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)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										24
									
								
								examples.md
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								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=<path to cache directory>`.
 | 
			
		||||
 | 
			
		||||
## C# - NuGet
 | 
			
		||||
Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user