Skip to content

Commit 03398f3

Browse files
committed
doc
1 parent 8698bff commit 03398f3

File tree

2 files changed

+73
-5
lines changed

2 files changed

+73
-5
lines changed

README.rst

+67-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ It automates two tasks:
1818
The version extraction helps to get the version in the application and SBOM right.
1919
The SBOM contains the files you mention explicitly, just like you mention what to ``install()`` in CMake.
2020

21-
To integrate this library in your project, see `below <sec_how_to_use_>` for basic instructions or the `example`_ for a complete example project.
21+
To integrate this library in your project, see `below <sec_how_to_use_>`_ for basic instructions or the `example`_ for a complete example project.
2222

2323
.. _SPDX: https://spdx.github.io/spdx-spec/v2.3/
2424
.. _NTIA: http://ntia.gov/SBOM
@@ -36,6 +36,9 @@ To integrate this library in your project, see `below <sec_how_to_use_>` for bas
3636
- `sbom_generate() <sec_sbom_generate_>`_
3737
- `sbom_add() <sec_sbom_add_>`_
3838
- `sbom_finalize() <sec_sbom_finalize_>`_
39+
- `REUSE compliance <sec_reuse_>`_
40+
- `reuse_lint() <sec_reuse_lint_>`_
41+
- `reuse_spdx() <sec_reuse_spdx_>`_
3942
- `How to use <sec_how_to_use_>`_
4043
- `Testing <sec_testing_>`_
4144
- `License <sec_license_>`_
@@ -390,6 +393,69 @@ Finalize the SBOM and verify its contents and/or format.
390393

391394

392395

396+
.. _sec_reuse:
397+
398+
|  
399+
400+
REUSE
401+
-----
402+
403+
This section lists a few functions that help with `REUSE`_ compliance of your repository.
404+
405+
.. _sec_reuse_lint:
406+
407+
|  
408+
409+
``reuse_lint``
410+
``````````````
411+
412+
Perform checking for `REUSE`_ compliance of the project repository source files.
413+
414+
.. code:: cmake
415+
416+
reuse_lint(
417+
[TARGET <target>]
418+
[CONFIG] [ALL]
419+
)
420+
421+
``TARGET``
422+
Target name to run the linter.
423+
Defaults to ``${PROJECT_NAME}-reuse-lint`` when omitted.
424+
425+
``CONFIG``
426+
Run the linting during CMake configure instead of during build.
427+
When this flag is set, the target is still created too.
428+
429+
``ALL``
430+
Add a dependency from ``all`` to the ``TARGET``.
431+
432+
433+
434+
.. _sec_reuse_spdx:
435+
436+
|  
437+
438+
``reuse_spdx``
439+
``````````````
440+
441+
Export an SPDX file based on the source code of the project with copyright and license information.
442+
443+
.. code:: cmake
444+
445+
reuse_spdx(
446+
[TARGET <target>]
447+
[OUTPUT <file>]
448+
)
449+
450+
``TARGET``
451+
Target name that executes the exporter.
452+
Defaults to ``${PROJECT_NAME}-reuse-spdx``.
453+
454+
``OUTPUT``
455+
The output SPDX file.
456+
457+
458+
393459
.. _sec_how_to_use:
394460

395461
|  

cmake/sbom.cmake

+6-4
Original file line numberDiff line numberDiff line change
@@ -942,23 +942,25 @@ endfunction()
942942
# packages installed (see dist/common/requirements.txt).
943943
function(reuse_spdx)
944944
set(options)
945-
set(oneValueArgs TARGET)
945+
set(oneValueArgs TARGET OUTPUT)
946946
set(multiValueArgs)
947947
cmake_parse_arguments(REUSE_SPDX "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
948948

949949
if(NOT REUSE_SPDX_TARGET)
950950
set(REUSE_SPDX_TARGET ${PROJECT_NAME}-reuse-spdx)
951951
endif()
952952

953+
if(NOT REUSE_SPDX_OUTPUT)
954+
set(REUSE_SPDX_OUTPUT "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src.spdx")
955+
endif()
956+
953957
if(NOT TARGET ${REUSE_SPDX_TARGET})
954958
sbom_find_python(REQUIRED)
955959

956-
set(outfile "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src.spdx")
957-
958960
add_custom_target(
959961
${REUSE_SPDX_TARGET} ALL
960962
COMMAND ${Python3_EXECUTABLE} -m reuse --root "${PROJECT_SOURCE_DIR}" spdx
961-
-o "${outfile}"
963+
-o "${REUSE_SPDX_OUTPUT}"
962964
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
963965
VERBATIM
964966
)

0 commit comments

Comments
 (0)