Skip to content

Commit 1175c52

Browse files
committed
feat: FetchContent example
1 parent 948cf95 commit 1175c52

3 files changed

Lines changed: 36 additions & 2 deletions

File tree

.github/workflows/release.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,10 @@ jobs:
2929
repo_token: ${{ secrets.GITHUB_TOKEN }}
3030
file: build/test_cmake.zip
3131
tag: ${{ github.ref }}
32+
33+
- name: Add fetch_test_cmake.cmake to release
34+
uses: svenstaro/upload-release-action@v2
35+
with:
36+
repo_token: ${{ secrets.GITHUB_TOKEN }}
37+
file: fetch_test_cmake.cmake
38+
tag: ${{ github.ref }}

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
# `test_cmake`
22

3-
Unit test framework CMake projects.
3+
Unit test framework for CMake projects.
4+
5+
# Include in your CMake project
6+
7+
The easiest way to use this library in your project is to use CMake's [FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html) API.
8+
9+
* Commit the FetchContent script to your repository:
10+
```
11+
wget https://github.com/intercreate/test-cmake/releases/latest/download/fetch_test_cmake.cmake
12+
```
13+
* Include it wherever you'd like to use functions from this library:
14+
```
15+
include(fetch_test_cmake.cmake)
16+
```
417

518
# Contributions
619

720
* Fork this repository: https://github.com/intercreate/test-cmake/fork
821
* Clone your fork: `git clone git@github.com:<YOUR_FORK>/test-cmake.git`
922
* then change directory to your cloned fork: `cd test-cmake`
10-
* Enabled the githook: `git config core.hooksPath .githooks`
23+
* Enabled the githook: `git config core.hooksPath .githooks`

fetch_test_cmake.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) 2023 Intercreate, Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# Authors: J.P. Hutchins <jp@intercreate.io>
5+
6+
include(FetchContent)
7+
8+
FetchContent_Declare(test_cmake
9+
URL https://github.com/intercreate/test-cmake/releases/latest/download/test_cmake.zip
10+
DOWNLOAD_EXTRACT_TIMESTAMP true
11+
)
12+
FetchContent_MakeAvailable(test_cmake)
13+
14+
include(${CMAKE_BINARY_DIR}/_deps/test_cmake-src/test_cmake.cmake)

0 commit comments

Comments
 (0)