From 639eee1a0cc9d51e6f6c467453b121667319e003 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 11 Feb 2025 09:23:06 -0500 Subject: Help: Call out target_link_libraries legacy signatures earlier --- Help/command/target_link_libraries.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst index 064e96f..4376e93 100644 --- a/Help/command/target_link_libraries.rst +++ b/Help/command/target_link_libraries.rst @@ -191,6 +191,9 @@ exclusively by this signature private. Libraries for a Target and/or its Dependents (Legacy) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +This signature is for compatibility only. Prefer the ``PUBLIC`` or +``PRIVATE`` keywords instead. + .. code-block:: cmake target_link_libraries( @@ -200,9 +203,6 @@ Libraries for a Target and/or its Dependents (Legacy) The ``LINK_PUBLIC`` and ``LINK_PRIVATE`` modes can be used to specify both the link dependencies and the link interface in one command. -This signature is for compatibility only. Prefer the ``PUBLIC`` or -``PRIVATE`` keywords instead. - Libraries and targets following ``LINK_PUBLIC`` are linked to, and are made part of the :prop_tgt:`INTERFACE_LINK_LIBRARIES`. If policy :policy:`CMP0022` is not ``NEW``, they are also made part of the @@ -213,6 +213,9 @@ made part of the :prop_tgt:`INTERFACE_LINK_LIBRARIES`. If policy Libraries for Dependents Only (Legacy) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +This signature is for compatibility only. Prefer the ``INTERFACE`` mode +instead. + .. code-block:: cmake target_link_libraries( LINK_INTERFACE_LIBRARIES ...) @@ -223,9 +226,6 @@ for linking. If policy :policy:`CMP0022` is not ``NEW``, then this mode also appends libraries to the :prop_tgt:`LINK_INTERFACE_LIBRARIES` and its per-configuration equivalent. -This signature is for compatibility only. Prefer the ``INTERFACE`` mode -instead. - Libraries specified as ``debug`` are wrapped in a generator expression to correspond to debug builds. If policy :policy:`CMP0022` is not ``NEW``, the libraries are also appended to the -- cgit v0.12 From b4bac3018fac256e48a0ae3be52c153ff72a06a1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 11 Feb 2025 09:24:07 -0500 Subject: Help: Drop target_link_libraries mention of CMP0003 and CMP0004 These policies have been removed by CMake 4.0 and have not been practically relevant in many years. Issue: #26679 --- Help/command/target_link_libraries.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst index 4376e93..a7db2a1 100644 --- a/Help/command/target_link_libraries.rst +++ b/Help/command/target_link_libraries.rst @@ -120,9 +120,6 @@ Each ```` may be: Additionally, a generator expression may be used as a fragment of any of the above items, e.g. ``foo$<1:_d>``. - Note that generator expressions will not be used in OLD handling of - policy :policy:`CMP0003` or policy :policy:`CMP0004`. - * A ``debug``, ``optimized``, or ``general`` keyword immediately followed by another ````. The item following such a keyword will be used only for the corresponding build configuration. The ``debug`` keyword -- cgit v0.12 From b7dc28cb8c50e99df413607bc35a2b78e30cbb30 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 11 Feb 2025 09:28:34 -0500 Subject: Help: Drop target_link_libraries redundant prose on debug/optimized keywords This is already documented in the overview, and does not need to be repeated for a specific signature. Issue: #26679 --- Help/command/target_link_libraries.rst | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst index a7db2a1..2e8340d 100644 --- a/Help/command/target_link_libraries.rst +++ b/Help/command/target_link_libraries.rst @@ -223,19 +223,6 @@ for linking. If policy :policy:`CMP0022` is not ``NEW``, then this mode also appends libraries to the :prop_tgt:`LINK_INTERFACE_LIBRARIES` and its per-configuration equivalent. -Libraries specified as ``debug`` are wrapped in a generator expression to -correspond to debug builds. If policy :policy:`CMP0022` is -not ``NEW``, the libraries are also appended to the -:prop_tgt:`LINK_INTERFACE_LIBRARIES_DEBUG >` -property (or to the properties corresponding to configurations listed in -the :prop_gbl:`DEBUG_CONFIGURATIONS` global property if it is set). -Libraries specified as ``optimized`` are appended to the -:prop_tgt:`INTERFACE_LINK_LIBRARIES` property. If policy :policy:`CMP0022` -is not ``NEW``, they are also appended to the -:prop_tgt:`LINK_INTERFACE_LIBRARIES` property. Libraries specified as -``general`` (or without any keyword) are treated as if specified for both -``debug`` and ``optimized``. - .. _`Linking Object Libraries`: Linking Object Libraries -- cgit v0.12 From 1d07da09120a1b7e925d3e2f6c8fa06bc12030db Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 11 Feb 2025 09:30:42 -0500 Subject: Help: Clarify context of target_link_libraries pre-4.0 behavior documentation Update paragraphs that exist only to document pre-4.0 behavior to explicitly state so. Fixes: #26679 --- Help/command/target_link_libraries.rst | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst index 2e8340d..ab01307 100644 --- a/Help/command/target_link_libraries.rst +++ b/Help/command/target_link_libraries.rst @@ -179,8 +179,10 @@ When this target is linked into another target then the libraries linked to this target will appear on the link line for the other target too. This transitive "link interface" is stored in the :prop_tgt:`INTERFACE_LINK_LIBRARIES` target property and may be overridden -by setting the property directly. When :policy:`CMP0022` is not set to -``NEW``, transitive linking is built in but may be overridden by the +by setting the property directly. + +In CMake versions prior to 4.0, if :policy:`CMP0022` is not set to ``NEW``, +transitive linking is built in but may be overridden by the :prop_tgt:`LINK_INTERFACE_LIBRARIES` property. Calls to other signatures of this command may set the property making any libraries linked exclusively by this signature private. @@ -201,11 +203,13 @@ The ``LINK_PUBLIC`` and ``LINK_PRIVATE`` modes can be used to specify both the link dependencies and the link interface in one command. Libraries and targets following ``LINK_PUBLIC`` are linked to, and are -made part of the :prop_tgt:`INTERFACE_LINK_LIBRARIES`. If policy -:policy:`CMP0022` is not ``NEW``, they are also made part of the -:prop_tgt:`LINK_INTERFACE_LIBRARIES`. Libraries and targets following -``LINK_PRIVATE`` are linked to, but are not made part of the -:prop_tgt:`INTERFACE_LINK_LIBRARIES` (or :prop_tgt:`LINK_INTERFACE_LIBRARIES`). +made part of the :prop_tgt:`INTERFACE_LINK_LIBRARIES`. + +In CMake versions prior to 4.0, if policy :policy:`CMP0022` is not ``NEW``, +they are also made part of the :prop_tgt:`LINK_INTERFACE_LIBRARIES`. +Libraries and targets following ``LINK_PRIVATE`` are linked to, but are +not made part of the :prop_tgt:`INTERFACE_LINK_LIBRARIES` +(or :prop_tgt:`LINK_INTERFACE_LIBRARIES`). Libraries for Dependents Only (Legacy) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -219,9 +223,11 @@ instead. The ``LINK_INTERFACE_LIBRARIES`` mode appends the libraries to the :prop_tgt:`INTERFACE_LINK_LIBRARIES` target property instead of using them -for linking. If policy :policy:`CMP0022` is not ``NEW``, then this mode -also appends libraries to the :prop_tgt:`LINK_INTERFACE_LIBRARIES` and its -per-configuration equivalent. +for linking. + +In CMake versions prior to 4.0, if policy :policy:`CMP0022` is not ``NEW``, +then this mode also appends libraries to the +:prop_tgt:`LINK_INTERFACE_LIBRARIES` and its per-configuration equivalent. .. _`Linking Object Libraries`: -- cgit v0.12