cmake/Help/policy/CMP0209.rst
Craig Scott 20219414c3
File sets: Always verify interface files sets of executable targets
When VERIFY_INTERFACE_FILE_SETS is set to true on an executable
target, verification of that target's interface file sets was only being
performed if the target's ENABLE_EXPORTS property was set to true.
We now always verify the interface file sets of executable targets,
subject to the new CMP0209 policy. This allows interface file sets to
be verified even for executable targets that do not export symbols.
Interface file sets containing headers that are fully inlined is an
example use case for this scenario. Unit test executables may link
to the executable under test, possibly with $<COMPILE_ONLY:...>.

Issue: #23448 #27046
2026-01-16 18:10:14 +11:00

28 lines
1.2 KiB
ReStructuredText

CMP0209
-------
.. versionadded:: 4.3
Verify interface header sets checks executables without exports.
When :prop_tgt:`VERIFY_INTERFACE_HEADER_SETS` is set to true on an executable
target, CMake 4.2 and below would only perform those checks if the target's
:prop_tgt:`ENABLE_EXPORTS` property was true. The reasoning behind this
exclusion was that no other target could consume the headers of an executable
target if that executable target didn't export symbols. Since then, other
use cases have emerged for verifying header file sets where exporting symbols
is no longer a requirement. Therefore, CMake 4.3 and above prefer to verify
interface file sets of executable targets regardless of whether they export
symbols or not.
The ``OLD`` behavior of this policy only verifies interface file sets of an
executable target if its :prop_tgt:`ENABLE_EXPORTS` property is set to true.
The ``NEW`` behavior always verifies interface file sets of an executable
target when :prop_tgt:`VERIFY_INTERFACE_HEADER_SETS` is set to true.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 4.3
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
.. include:: include/STANDARD_ADVICE.rst
.. include:: include/DEPRECATED.rst