project: Add SPDX_LICENSE argument

Add an argument to the `project` command to allow specifying a license
for a project as a whole. This is in addition to specifying licenses on
individual targets, and will be used to set the license(s) on exported
packages.

Also, move listing of `COMPAT_VERSION` variables to follow
lexicographical order.
This commit is contained in:
Matthew Woehlke
2025-06-13 12:07:02 -04:00
parent f0b419c473
commit fba540daf6
18 changed files with 122 additions and 8 deletions

View File

@@ -12,6 +12,7 @@ Synopsis
project(<PROJECT-NAME>
[VERSION <major>[.<minor>[.<patch>[.<tweak>]]]]
[COMPAT_VERSION <major>[.<minor>[.<patch>[.<tweak>]]]]
[SPDX_LICENSE <license-string>]
[DESCRIPTION <description-string>]
[HOMEPAGE_URL <url-string>]
[LANGUAGES <language-name>...])
@@ -106,6 +107,29 @@ The options are:
``CMakeLists.txt``, then the compatibility version is also stored in the
variable :variable:`CMAKE_PROJECT_COMPAT_VERSION`.
``SPDX_LICENSE <license-string>``
.. versionadded:: 4.2
Optional.
Sets the variables
* :variable:`PROJECT_SPDX_LICENSE`,
:variable:`<PROJECT-NAME>_SPDX_LICENSE`
to ``<license-string>``, which shall be a |SPDX|_ (SPDX)
`License Expression`_ that describes the license(s) of the project as a
whole, including documentation, resources, or other materials distributed
with the project, in addition to software artifacts. See the SPDX
`License List`_ for a list of commonly used licenses and their identifiers.
See the :prop_tgt:`SPDX_LICENSE` property for specifying the license(s) on
individual software artifacts.
.. _SPDX: https://spdx.dev/
.. |SPDX| replace:: System Package Data Exchange
.. _License Expression: https://spdx.github.io/spdx-spec/v3.0.1/annexes/spdx-license-expressions/
.. _License List: https://spdx.org/licenses/
``DESCRIPTION <description-string>``
.. versionadded:: 3.9