-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 411a526
Showing
8 changed files
with
227 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
format: | ||
tab_size: 2 | ||
line_width: 100 | ||
dangle_parens: true | ||
|
||
parse: | ||
additional_commands: | ||
cpmaddpackage: | ||
pargs: | ||
nargs: '*' | ||
flags: [] | ||
spelling: CPMAddPackage | ||
kwargs: &cpmaddpackagekwargs | ||
NAME: 1 | ||
FORCE: 1 | ||
VERSION: 1 | ||
GIT_TAG: 1 | ||
DOWNLOAD_ONLY: 1 | ||
GITHUB_REPOSITORY: 1 | ||
GITLAB_REPOSITORY: 1 | ||
GIT_REPOSITORY: 1 | ||
SVN_REPOSITORY: 1 | ||
SVN_REVISION: 1 | ||
SOURCE_DIR: 1 | ||
DOWNLOAD_COMMAND: 1 | ||
FIND_PACKAGE_ARGUMENTS: 1 | ||
NO_CACHE: 1 | ||
GIT_SHALLOW: 1 | ||
URL: 1 | ||
URL_HASH: 1 | ||
URL_MD5: 1 | ||
DOWNLOAD_NAME: 1 | ||
DOWNLOAD_NO_EXTRACT: 1 | ||
HTTP_USERNAME: 1 | ||
HTTP_PASSWORD: 1 | ||
OPTIONS: + | ||
cpmfindpackage: | ||
pargs: | ||
nargs: '*' | ||
flags: [] | ||
spelling: CPMFindPackage | ||
kwargs: *cpmaddpackagekwargs | ||
cpmdeclarepackage: | ||
pargs: | ||
nargs: '*' | ||
flags: [] | ||
spelling: CPMDeclarePackage | ||
kwargs: *cpmaddpackagekwargs | ||
packageproject: | ||
pargs: | ||
nargs: '*' | ||
flags: [] | ||
spelling: packageProject | ||
kwargs: | ||
NAME: 1 | ||
VERSION: 1 | ||
INCLUDE_DIR: 1 | ||
INCLUDE_DESTINATION: 1 | ||
BINARY_DIR: 1 | ||
COMPATIBILITY: 1 | ||
VERSION_HEADER: 1 | ||
DEPENDENCIES: + | ||
cpmusepackagelock: | ||
pargs: 1 | ||
spelling: CPMUsePackageLock | ||
cpmregisterpackage: | ||
pargs: 1 | ||
spelling: CPMRegisterPackage | ||
cpmgetpackageversion: | ||
pargs: 2 | ||
spelling: CPMGetPackageVersion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Check | ||
|
||
on: | ||
push: | ||
branches: [master, main] | ||
pull_request: | ||
branches: [master, main] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: write licences | ||
run: | | ||
cmake -S test/project -B build/test | ||
cmake --build build/test --target write-licences | ||
- name: check licences | ||
run: | | ||
grep -q Catch2 build/third_party.txt | ||
grep -q fmt build/third_party.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Style | ||
|
||
on: | ||
push: | ||
branches: [master, main] | ||
pull_request: | ||
branches: [master, main] | ||
|
||
jobs: | ||
style: | ||
|
||
runs-on: macos-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Install format dependencies | ||
run: | | ||
brew install clang-format | ||
pip3 install cmake_format==0.6.11 pyyaml | ||
- name: configure | ||
run: cmake -Htest/style -Bbuild/style | ||
|
||
- name: check style | ||
run: cmake --build build/style --target check-format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
function(write_licence_disclaimer FILE_NAME PACKAGES) | ||
file(WRITE ${FILE_NAME} "") | ||
set(PRINT_DELIMITER OFF) | ||
foreach(package ${PACKAGES}) | ||
if(PRINT_DELIMITER) | ||
file(APPEND ${FILE_NAME} "\n-----\n") | ||
endif() | ||
file(GLOB licences "${${package}_SOURCE_DIR}/LICENSE*" "${${package}_SOURCE_DIR}/LICENCE*") | ||
list(LENGTH licences LICENSE_COUNT) | ||
if(LICENSE_COUNT GREATER_EQUAL 1) | ||
list(GET licences 0 licence) | ||
file(READ ${licence} LICENCE_TEXT) | ||
file(APPEND ${FILE_NAME} | ||
"The following software may be included in this product: ${package}\n\n${LICENCE_TEXT}\n" | ||
) | ||
set(PRINT_DELIMITER ON) | ||
else() | ||
message("WARNING: no licence files found for package \"${package}\".") | ||
endif() | ||
if(LICENSE_COUNT GREATER 1) | ||
message( | ||
"WARNING: multiple licence files found for package \"${package}\": ${licences}. Only first file will be used." | ||
) | ||
endif() | ||
endforeach() | ||
message("wrote licences to ${FILE_NAME}") | ||
endfunction() | ||
|
||
set(CPMLicences_SCRIPT_PATH | ||
${CMAKE_CURRENT_LIST_FILE} | ||
CACHE INTERNAL "" | ||
) | ||
|
||
function(create_write_licence_disclaimer_target TARGET_NAME FILE_NAME PACKAGES) | ||
message("add target for licences: ${PACKAGES}") | ||
|
||
set(PACKAGE_SOURCES "") | ||
foreach(package ${PACKAGES}) | ||
list(APPEND PACKAGE_SOURCES "-D${package}_SOURCE_DIR=\"${${package}_SOURCE_DIR}\"") | ||
endforeach() | ||
|
||
add_custom_target( | ||
${TARGET_NAME} | ||
COMMAND | ||
${CMAKE_COMMAND} -DPRINT_LICENCE_FILE_NAME=${FILE_NAME} | ||
"-DPRINT_LICENCE_PACKAGES=\"${PACKAGES}\"" ${PACKAGE_SOURCES} -P ${CPMLicences_SCRIPT_PATH} | ||
) | ||
endfunction() | ||
|
||
if(PRINT_LICENCE_FILE_NAME) | ||
write_licence_disclaimer(${PRINT_LICENCE_FILE_NAME} "${PRINT_LICENCE_PACKAGES}") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
set(CPM_DOWNLOAD_VERSION 0.27.5) | ||
|
||
if(CPM_SOURCE_CACHE) | ||
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
elseif(DEFINED ENV{CPM_SOURCE_CACHE}) | ||
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
else() | ||
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
endif() | ||
|
||
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION})) | ||
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}") | ||
file(DOWNLOAD | ||
https://github.com/TheLartians/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake | ||
${CPM_DOWNLOAD_LOCATION} | ||
) | ||
endif() | ||
|
||
include(${CPM_DOWNLOAD_LOCATION}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
cmake_minimum_required(VERSION 3.14 FATAL_ERROR) | ||
project(CPMLicenceTest) | ||
|
||
include(../../cmake/CPM.cmake) | ||
|
||
CPMAddPackage(NAME CPMLicences SOURCE_DIR ..) | ||
|
||
CPMAddPackage( | ||
NAME Catch2 | ||
GITHUB_REPOSITORY catchorg/Catch2 | ||
VERSION 2.5.0 | ||
) | ||
|
||
CPMAddPackage( | ||
NAME fmt | ||
GIT_TAG 6.1.2 | ||
GITHUB_REPOSITORY fmtlib/fmt | ||
) | ||
|
||
create_write_licence_disclaimer_target( | ||
write-licences "${CMAKE_CURRENT_BINARY_DIR}/third_party.txt" "${CPM_PACKAGES}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cmake_minimum_required(VERSION 3.14 FATAL_ERROR) | ||
project(CPMLicenceTest) | ||
|
||
include(../../cmake/CPM.cmake) | ||
|
||
CPMAddPackage( | ||
NAME Format.cmake | ||
VERSION 1.6 | ||
GITHUB_REPOSITORY TheLartians/Format.cmake | ||
OPTIONS "FORMAT_CHECK_CMAKE ON" | ||
) |