project: add COMPAT_VERSION keyword

Fixes: #26893
This commit is contained in:
Vito Gamberini
2025-04-22 07:00:06 -04:00
parent 468270d8ac
commit 0138df29dc
25 changed files with 189 additions and 15 deletions
+19
View File
@@ -11,6 +11,7 @@ Synopsis
project(<PROJECT-NAME> [<language-name>...])
project(<PROJECT-NAME>
[VERSION <major>[.<minor>[.<patch>[.<tweak>]]]]
[COMPAT_VERSION <major>[.<minor>[.<patch>[.<tweak>]]]]
[DESCRIPTION <project-description-string>]
[HOMEPAGE_URL <url-string>]
[LANGUAGES <language-name>...])
@@ -86,6 +87,24 @@ The options are:
``CMakeLists.txt``, then the version is also stored in the variable
:variable:`CMAKE_PROJECT_VERSION`.
``COMPAT_VERSION <version>``
.. note::
Experimental. Gated by ``CMAKE_EXPERIMENTAL_EXPORT_PACKAGE_INFO``.
Optional; requires ``VERSION`` also be set.
Takes a ``<version>`` argument composed of non-negative integer components,
i.e. ``<major>[.<minor>[.<patch>[.<tweak>]]]``,
and sets the variables
* :variable:`PROJECT_COMPAT_VERSION`,
:variable:`<PROJECT-NAME>_COMPAT_VERSION`
When the ``project()`` command is called from the top-level
``CMakeLists.txt``, then the compatibility version is also stored in the
variable :variable:`CMAKE_PROJECT_COMPAT_VERSION`.
``DESCRIPTION <project-description-string>``
.. versionadded:: 3.9