From 94c221d57389bd280a54487d2adc02ab23d0d60d Mon Sep 17 00:00:00 2001 From: Lars Melchior Date: Wed, 6 Jan 2021 18:11:24 +0100 Subject: [PATCH] add readme --- README.md | 33 +++++++++++++++++++++++++++++++++ test/project/CMakeLists.txt | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..a592395 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# CPMlicenses.cmake + +A license collector for your projects using CPM.cmake. + +## About + +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. + +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. + +## Usage + +Use [CPM.cmake](https://github.com/TheLartians/CPM.cmake) to add CPMLicenses.cmake to your project. + +```cmake +CPMAddPackage( + NAME CPMLicenses.cmake + GITHUB_REPOSITORY TheLartians/CPMlicenses.cmake + VERSION 0.0.1 +) +``` + +After all additional dependencies have been added, create the target by calling `cpm_licenses_create_disclaimer_target( )`. Afterwards, simply build the CMake target with the specified name to create the file containing the licenses. + +For example, with the configuration + +```cmake +cpm_licenses_create_disclaimer_target( + write-licenses "${CMAKE_CURRENT_BINARY_DIR}/third_party.txt" "${CPM_PACKAGES}" +) +``` + +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. diff --git a/test/project/CMakeLists.txt b/test/project/CMakeLists.txt index edb110f..0abdbad 100644 --- a/test/project/CMakeLists.txt +++ b/test/project/CMakeLists.txt @@ -3,7 +3,7 @@ project(CPMlicenseTest) include(../../cmake/CPM.cmake) -CPMAddPackage(NAME CPMlicenses.cmake SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..) +CPMAddPackage(NAME CPMLicenses.cmake SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..) CPMAddPackage( NAME Catch2