From 0fb923c46041d67110c8e0907afdf66b3b25f25a Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 14 Jan 2023 23:58:28 -0500 Subject: cmGeneratorExpressionNode: implement `COMPILE_ONLY` genex This generator expression is the inverse of `LINK_ONLY` and only coveys usage requirements for the purposes of compilation. Its intended use is to avoid needing to export targets that do not have link usage requirements (e.g., header-only libraries) when used by another target. It will also be used to represent private usage requirements on exported C++ module-containing targets in the future. Eventually there should be logic to collapse nesting of `$` and `$` when generating instances of either. A TODO is left in the code for this case. See: #15415 --- Help/manual/cmake-generator-expressions.7.rst | 19 ++++++++++++++++++- Help/release/dev/genex-compile-only.rst | 5 +++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 Help/release/dev/genex-compile-only.rst (limited to 'Help') diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 9da37999b1..186a9d25f9 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -959,6 +959,22 @@ Compile Features :manual:`cmake-compile-features(7)` manual for information on compile features and a list of supported compilers. +Compile Context +^^^^^^^^^^^^^^^ + +.. genex:: $ + + .. versionadded:: 3.27 + + Content of ``...``, except while collecting :ref:`Target Usage Requirements`, + in which case it is the empty string. This is intended for use in an + :prop_tgt:`INTERFACE_LINK_LIBRARIES` target property, typically populated + via the :command:`target_link_libraries` command, to specify private + compilation requirements without other usage requirements. + + Use cases include header-only usage where all usages are known to not have + linking requirements (e.g., all-``inline`` or C++ template libraries). + Linker Language And ID ^^^^^^^^^^^^^^^^^^^^^^ @@ -1339,7 +1355,8 @@ Link Context in which case it is the empty string. This is intended for use in an :prop_tgt:`INTERFACE_LINK_LIBRARIES` target property, typically populated via the :command:`target_link_libraries` command, to specify private link - dependencies without other usage requirements. + dependencies without other usage requirements such as include directories or + compile options. .. versionadded:: 3.24 ``LINK_ONLY`` may also be used in a :prop_tgt:`LINK_LIBRARIES` target diff --git a/Help/release/dev/genex-compile-only.rst b/Help/release/dev/genex-compile-only.rst new file mode 100644 index 0000000000..1f898d8620 --- /dev/null +++ b/Help/release/dev/genex-compile-only.rst @@ -0,0 +1,5 @@ +genex-compile-only +------------------ + +* The :genex:`COMPILE_ONLY` generator expression has been added which provides + compilation usage requirements without any linking requirements. -- cgit v1.2.1