mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-10 19:39:52 -05:00
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:
41
Help/variable/CMAKE_PROJECT_SPDX_LICENSE.rst
Normal file
41
Help/variable/CMAKE_PROJECT_SPDX_LICENSE.rst
Normal file
@@ -0,0 +1,41 @@
|
||||
CMAKE_PROJECT_SPDX_LICENSE
|
||||
--------------------------
|
||||
|
||||
.. versionadded:: 4.2
|
||||
|
||||
.. note::
|
||||
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_EXPORT_PACKAGE_INFO``.
|
||||
|
||||
The license(s) of the top level project.
|
||||
|
||||
This variable holds the license expression of the project as specified in the
|
||||
top level CMakeLists.txt file by a :command:`project` command. In the event
|
||||
that the top level CMakeLists.txt contains multiple :command:`project` calls,
|
||||
the most recently called one from that top level CMakeLists.txt will determine
|
||||
the value that ``CMAKE_PROJECT_SPDX_LICENSE`` contains. For example, consider
|
||||
the following top level CMakeLists.txt:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
cmake_minimum_required(VERSION 4.2)
|
||||
project(First SPDX_LICENSE "BSD-3-Clause")
|
||||
project(Second SPDX_LICENSE "BSD-3-Clause AND CC-BY-SA-4.0")
|
||||
add_subdirectory(sub)
|
||||
project(Third SPDX_LICENSE "BSD-3-Clause AND CC0-1.0")
|
||||
|
||||
And ``sub/CMakeLists.txt`` with the following contents:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
project(SubProj SPDX_LICENSE Apache-2.0)
|
||||
message("CMAKE_PROJECT_SPDX_LICENSE = ${CMAKE_PROJECT_SPDX_LICENSE}")
|
||||
|
||||
The most recently seen :command:`project` command from the top level
|
||||
CMakeLists.txt would be ``project(Second ...)``, so this will print::
|
||||
|
||||
CMAKE_PROJECT_SPDX_LICENSE = BSD-3-Clause AND CC-BY-SA-4.0
|
||||
|
||||
To obtain the version from the most recent call to :command:`project` in
|
||||
the current directory scope or above, see the :variable:`PROJECT_SPDX_LICENSE`
|
||||
variable.
|
||||
11
Help/variable/PROJECT-NAME_SPDX_LICENSE.rst
Normal file
11
Help/variable/PROJECT-NAME_SPDX_LICENSE.rst
Normal file
@@ -0,0 +1,11 @@
|
||||
<PROJECT-NAME>_SPDX_LICENSE
|
||||
---------------------------
|
||||
|
||||
.. versionadded:: 4.2
|
||||
|
||||
.. note::
|
||||
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_EXPORT_PACKAGE_INFO``.
|
||||
|
||||
Value given to the ``SPDX_LICENSE`` option of the most recent call to the
|
||||
:command:`project` command with project name ``<PROJECT-NAME>``, if any.
|
||||
12
Help/variable/PROJECT_SPDX_LICENSE.rst
Normal file
12
Help/variable/PROJECT_SPDX_LICENSE.rst
Normal file
@@ -0,0 +1,12 @@
|
||||
PROJECT_SPDX_LICENSE
|
||||
--------------------
|
||||
|
||||
.. versionadded:: 4.2
|
||||
|
||||
.. note::
|
||||
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_EXPORT_PACKAGE_INFO``.
|
||||
|
||||
Value given to the ``SPDX_LICENSE`` option of the most recent call to the
|
||||
:command:`project` command, if any. To obtain the compatibility version of the
|
||||
top level project, see the :variable:`CMAKE_PROJECT_SPDX_LICENSE` variable.
|
||||
Reference in New Issue
Block a user