Skip to content

Commit

Permalink
Add support for licenses that use a "COPYING" file (#3)
Browse files Browse the repository at this point in the history
* Add support for licenses that use a "COPYING" file

Some projects like https://github.com/TartanLlama/expected use a `COPYING` file for their license. This adds support for this case.

* Add test for projects with COPYING file

* Fix formatting
  • Loading branch information
DeveloperPaul123 authored Oct 5, 2022
1 parent 4dd89bd commit 40d1b7f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ jobs:
grep -q Catch2 build/third_party.txt
grep -q fmt build/third_party.txt
grep -q sol2 build/third_party.txt
grep -q expected build/third_party.txt
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ function(write_license_disclaimer FILE_NAME PACKAGES)
file(WRITE ${FILE_NAME} "")
set(PRINT_DELIMITER OFF)
foreach(package ${PACKAGES})
file(GLOB licenses "${${package}_SOURCE_DIR}/LICENSE*" "${${package}_SOURCE_DIR}/LICENCE*")
file(GLOB licenses "${${package}_SOURCE_DIR}/LICENSE*" "${${package}_SOURCE_DIR}/LICENCE*"
"${${package}_SOURCE_DIR}/COPYING*"
)
list(LENGTH licenses LICENSE_COUNT)
if(LICENSE_COUNT GREATER_EQUAL 1)
if(PRINT_DELIMITER)
Expand Down
7 changes: 7 additions & 0 deletions test/project/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ CPMAddPackage(
DOWNLOAD_ONLY YES
)

CPMAddPackage(
NAME expected
GITHUB_REPOSITORY TartanLlama/expected
VERSION 1.0.0
DOWNLOAD_ONLY YES
)

cpm_licenses_create_disclaimer_target(
write-licenses "${CMAKE_CURRENT_BINARY_DIR}/third_party.txt" "${CPM_PACKAGES}"
)

0 comments on commit 40d1b7f

Please sign in to comment.