export: Add build-tree CPS support

Add Common Package Specification support to export(EXPORT).
This commit is contained in:
Matthew Woehlke
2025-02-25 15:42:23 -05:00
parent 4577e06d91
commit c8ccd5a9e3
91 changed files with 1032 additions and 28 deletions

View File

@@ -89,10 +89,10 @@ Exporting Targets to Android.mk
.. versionadded:: 3.7
This signature exports cmake built targets to the android ndk build system
This signature exports CMake built targets to the android ndk build system
by creating an ``Android.mk`` file that references the prebuilt targets. The
Android NDK supports the use of prebuilt libraries, both static and shared.
This allows cmake to build the libraries of a project and make them available
This allows CMake to build the libraries of a project and make them available
to an ndk build system complete with transitive dependencies, include flags
and defines required to use the libraries. The signature takes a list of
targets and puts them in the ``Android.mk`` file specified by the
@@ -127,6 +127,36 @@ of the :command:`install(TARGETS)` command.
Specify that :command:`find_dependency` calls should be exported. See
:command:`install(EXPORT)` for details on how this works.
Exporting Targets to the |CPS|
""""""""""""""""""""""""""""""
.. code-block:: cmake
export(EXPORT <export-name> PACKAGE_INFO <package-name>
[APPENDIX <appendix-name>]
[LOWER_CASE_FILE]
[VERSION <version>
[COMPAT_VERSION <version>]
[VERSION_SCHEMA <string>]]
[DEFAULT_TARGETS <target>...]
[DEFAULT_CONFIGURATIONS <config>...])
.. versionadded:: 4.1
.. note::
Experimental. Gated by ``CMAKE_EXPERIMENTAL_EXPORT_PACKAGE_INFO``.
Creates a file in the |CPS|_ that may be included by outside projects to import
targets named by ``<target>...`` from the current project's build tree. See
the :command:`install(PACKAGE_INFO)` command to export targets from an install
tree. The imported targets are implicitly in the namespace ``<package-name>``.
The default file name is ``<package-name>[-<appendix-name>].cps``. If the
``LOWER_CASE_FILE`` option is given, the file name will use the package name
converted to lower case.
See :command:`install(PACKAGE_INFO)` for a description of the other options.
Exporting Packages
^^^^^^^^^^^^^^^^^^
@@ -221,3 +251,6 @@ Configure the parameters of an export. The arguments are as follows:
this target. If specified, the generated code will check to see if the
``.xcframework`` exists, and if it does, it will use the ``.xcframework``
as its imported location instead of the installed library.
.. _CPS: https://cps-org.github.io/cps/
.. |CPS| replace:: Common Package Specification