From ebf0a359ad9c9422f61ee73fc15ca0c5ea939a03 Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Mon, 27 Oct 2025 10:38:40 -0400 Subject: [PATCH] Help: Improve documentation of project SPDX_LICENSE Currently, CMake allows specifying a license (`SPDX_LICENSE`) for both projects and targets, which is largely motivated by CPS export. The design of CPS is geared toward components (targets) only expressing an explicit license when that component's license differs from the license that applies to the package as a whole (or, at least, the license generally used by the package's software components). Accordingly, the project license is not used to initialize the `SPDX_LICENSE` target property at export time. This, however, was not documented previously. Add a note explaining this to the `SPDX_LICENSE` option of the `project` command. Fixes: #27295 --- Help/command/project.rst | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Help/command/project.rst b/Help/command/project.rst index a079bab0ee..dbe412de94 100644 --- a/Help/command/project.rst +++ b/Help/command/project.rst @@ -124,6 +124,17 @@ The options are: See the :prop_tgt:`SPDX_LICENSE` property for specifying the license(s) on individual software artifacts. + .. note:: + The project license is *not* used to initialize the + :prop_tgt:`SPDX_LICENSE` property of individual targets. This allows the + package license and default component license, which are specified when + exporting package information, to be meaningful. Only |CPS| exports make + use of this information. + + The project license *is* inherited as the package license in some cases. + Refer to the ``PROJECT`` option and related documentation of the + :command:`export` and :command:`install` commands for more information. + .. _SPDX: https://spdx.dev/ .. |SPDX| replace:: System Package Data Exchange @@ -179,8 +190,6 @@ intended for use as default values in package metadata and documentation. The :command:`export` and :command:`install` commands use these accordingly when generating |CPS| package descriptions. -.. |CPS| replace:: Common Package Specification - .. _`Code Injection`: Code Injection @@ -249,3 +258,5 @@ call exists, CMake will issue a warning and pretend there is a other commands whose behavior they may affect and for this reason the ``project()`` command will issue a warning if this order is not kept. See also policy :policy:`CMP0000`. + +.. |CPS| replace:: Common Package Specification