Skip to content

Commit 94c221d

Browse files
committed
add readme
1 parent b2dbb8c commit 94c221d

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# CPMlicenses.cmake
2+
3+
A license collector for your projects using CPM.cmake.
4+
5+
## About
6+
7+
Many open-source projects require adding a disclaimer to your binary reproducing the dependencies license. Finding and updating the disclaimer for all dependencies can be a tedious task. Luckily, if you've used [CPM.cmake](https://github.com/TheLartians/CPM.cmake) to add the dependencies this process can be automated.
8+
9+
CPMlicenses.cmake will automatically scan all source directories of your CPM.cmake dependencies and find any file that begins with `LICENCE` or `LICENSE`, appending the contents to an output file that you can use as a license disclaimer.
10+
11+
## Usage
12+
13+
Use [CPM.cmake](https://github.com/TheLartians/CPM.cmake) to add CPMLicenses.cmake to your project.
14+
15+
```cmake
16+
CPMAddPackage(
17+
NAME CPMLicenses.cmake
18+
GITHUB_REPOSITORY TheLartians/CPMlicenses.cmake
19+
VERSION 0.0.1
20+
)
21+
```
22+
23+
After all additional dependencies have been added, create the target by calling `cpm_licenses_create_disclaimer_target(<target name> <output file> <packages>)`. Afterwards, simply build the CMake target with the specified name to create the file containing the licenses.
24+
25+
For example, with the configuration
26+
27+
```cmake
28+
cpm_licenses_create_disclaimer_target(
29+
write-licenses "${CMAKE_CURRENT_BINARY_DIR}/third_party.txt" "${CPM_PACKAGES}"
30+
)
31+
```
32+
33+
building the target `write licenses` (e.g. `cmake --build build --target write-licenses`) will create the file `build/third_party.txt` containing all license disclaimers of the dependencies.

test/project/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ project(CPMlicenseTest)
33

44
include(../../cmake/CPM.cmake)
55

6-
CPMAddPackage(NAME CPMlicenses.cmake SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
6+
CPMAddPackage(NAME CPMLicenses.cmake SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
77

88
CPMAddPackage(
99
NAME Catch2

0 commit comments

Comments
 (0)