cmake/Help/policy/CMP0208.rst
Matthew Woehlke 2151e5f79d export, install: Improve argument parsing
Modify the `export(EXPORT)` and `install(PACKAGE_INFO)` commands to
actually enforce that certain arguments must be non-empty. With respect
to `export`, this is mainly targeted at CPS export, but ends up
affecting all flavors of `export(EXPORT)` because that is the level at
which argument parsing is performed.

Also, add unit tests to verify that the new rejection of arguments with
missing or empty values is working, update the existing tests due to
changes in error reporting, and remove no-longer-needed manual
validation of an empty `PACKAGE_INFO` argument.
2025-12-09 13:37:01 -05:00

31 lines
1.2 KiB
ReStructuredText

CMP0208
-------
.. versionadded:: 4.3
:command:`export(EXPORT)` does not allow empty arguments.
In CMake 4.2 and below, the :command:`export(EXPORT)` command silently
accepted ``NAMESPACE``, ``FILE`` or ``CXX_MODULES_DIRECTORY`` arguments with
empty or missing values.
CMake 4.3 and above issue a diagnostic if any of these keywords are present
without an associated value, or of the value given to ``FILE`` or
``CXX_MODULES_DIRECTORY`` is empty. (``NAMESPACE`` is allowed to have an empty
value, but an empty value must be quoted.) A diagnostic is also issued
immediately if the value of ``EXPORT`` is missing or empty. (Previously, this
would result in an error at generate-time because no export set whose name is
empty can exist.)
This policy provides compatibility with projects which may have relied on the
previous lack of enforcement. The ``OLD`` behavior for this policy permits
these keywords to be present without an accompanying value, or to be given an
empty value. The ``NEW`` behavior requires that a value be given, and that
the value (except for ``NAMESPACE``) is non-empty.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 4.3
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
.. include:: include/STANDARD_ADVICE.rst
.. include:: include/DEPRECATED.rst