From c8b672597795fb9b2bfe025fee2667a60f3d406e Mon Sep 17 00:00:00 2001 From: Tyler Yankee Date: Tue, 7 Apr 2026 09:16:32 -0400 Subject: [PATCH] Help: Mention CMAKE__LINK_FLAGS where relevant Also, correct the documentation added in commit 98f9874703 (cmake: Add per-language link flags for all target types, 2025-12-17) by placing the variables in the proper section of cmake-variables(7). Issue: #21934 --- Help/command/add_link_options.rst | 5 +++++ Help/command/target_link_options.rst | 5 +++++ Help/manual/cmake-toolchains.7.rst | 13 ++++++++++--- Help/manual/cmake-variables.7.rst | 4 ++-- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Help/command/add_link_options.rst b/Help/command/add_link_options.rst index 419ee5664d..462fee9985 100644 --- a/Help/command/add_link_options.rst +++ b/Help/command/add_link_options.rst @@ -42,3 +42,8 @@ See Also * :variable:`CMAKE__FLAGS` and :variable:`CMAKE__FLAGS_` add language-wide flags passed to all invocations of the compiler. This includes invocations that drive compiling and those that drive linking. + +* .. versionadded:: 4.3 + :variable:`CMAKE__LINK_FLAGS` and + :variable:`CMAKE__LINK_FLAGS_` add language-wide flags passed + to all invocations of the compiler which drive linking. diff --git a/Help/command/target_link_options.rst b/Help/command/target_link_options.rst index 10c8cf923f..9e55e9d3c7 100644 --- a/Help/command/target_link_options.rst +++ b/Help/command/target_link_options.rst @@ -67,5 +67,10 @@ See Also add language-wide flags passed to all invocations of the compiler. This includes invocations that drive compiling and those that drive linking. +* .. versionadded:: 4.3 + :variable:`CMAKE__LINK_FLAGS` and + :variable:`CMAKE__LINK_FLAGS_` add language-wide flags passed + to all invocations of the compiler which drive linking. + * The :module:`CheckLinkerFlag` module to check whether a linker flag is supported by the compiler. diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst index 4ff02a09e1..21363c7a5b 100644 --- a/Help/manual/cmake-toolchains.7.rst +++ b/Help/manual/cmake-toolchains.7.rst @@ -70,9 +70,16 @@ enabled: :variable:`CMAKE__COMPILER_VERSION` The version of the compiler. :variable:`CMAKE__FLAGS` - The variables and the configuration-specific equivalents contain flags that - will be added to the compile command when compiling a file of a particular - language. + These variables and the configuration-specific equivalents contain flags that + will be added to all invocations of the compiler for a particular language, + including those driving compiling and linking. + +:variable:`CMAKE__LINK_FLAGS` + .. versionadded:: 4.3 + + These variables and the configuration-specific equivalents contain flags that + will be added to all invocations of the compiler for a particular language + when driving linking only. CMake needs a way to determine which compiler to use to invoke the linker. This is determined by the :prop_sf:`LANGUAGE` property of source files of the diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index d7987baf6d..f9ca44432d 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -97,8 +97,6 @@ Variables that Provide Information /variable/CMAKE_LANG_COMPILER_LINKER_VERSION /variable/CMAKE_LANG_COMPILER_RANLIB /variable/CMAKE_LANG_DEVICE_LINK_MODE - /variable/CMAKE_LANG_LINK_FLAGS - /variable/CMAKE_LANG_LINK_FLAGS_CONFIG /variable/CMAKE_LANG_LINK_LIBRARY_SUFFIX /variable/CMAKE_LANG_LINK_MODE /variable/CMAKE_LINK_LIBRARY_SUFFIX @@ -706,6 +704,8 @@ Variables for Languages /variable/CMAKE_LANG_IMPLICIT_LINK_LIBRARIES /variable/CMAKE_LANG_LIBRARY_ARCHITECTURE /variable/CMAKE_LANG_LINK_EXECUTABLE + /variable/CMAKE_LANG_LINK_FLAGS + /variable/CMAKE_LANG_LINK_FLAGS_CONFIG /variable/CMAKE_LANG_LINKER_WRAPPER_FLAG /variable/CMAKE_LANG_LINKER_WRAPPER_FLAG_SEP /variable/CMAKE_LANG_OUTPUT_EXTENSION