File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,9 @@ foreach(dir examples include source test tools)
170
170
endforeach ()
171
171
file (GLOB_RECURSE format_src ${format_glob} )
172
172
173
+ # check for licence
174
+ VerifyLicence (${format_src} )
175
+
173
176
# Add code formatter target
174
177
add_custom_target (cppformat )
175
178
Original file line number Diff line number Diff line change @@ -146,3 +146,14 @@ function(FetchContentSparse_Declare name GIT_REPOSITORY GIT_TAG GIT_DIR)
146
146
WORKING_DIRECTORY ${content-build-dir} )
147
147
FetchContent_Declare (${name} SOURCE_DIR ${content-build-dir}/${GIT_DIR} )
148
148
endfunction ()
149
+
150
+
151
+ # Checks that every input file includes an appropriate license notice.
152
+ function (VerifyLicence )
153
+ foreach (file ${ARGN} )
154
+ file (READ ${file} file_contents LIMIT 300 )
155
+ if (NOT "${file_contents} " MATCHES "SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception" )
156
+ message (FATAL_ERROR "${file} does not contain an appropriate license comment." )
157
+ endif ()
158
+ endforeach ()
159
+ endfunction ()
You can’t perform that action at this time.
0 commit comments