Help: Mention CMAKE_<LANG>_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
This commit is contained in:
Tyler Yankee
2026-04-07 09:16:32 -04:00
parent 314e9790cf
commit c8b6725977
4 changed files with 22 additions and 5 deletions

View File

@@ -42,3 +42,8 @@ See Also
* :variable:`CMAKE_<LANG>_FLAGS` and :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>`
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_<LANG>_LINK_FLAGS` and
:variable:`CMAKE_<LANG>_LINK_FLAGS_<CONFIG>` add language-wide flags passed
to all invocations of the compiler which drive linking.

View File

@@ -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_<LANG>_LINK_FLAGS` and
:variable:`CMAKE_<LANG>_LINK_FLAGS_<CONFIG>` 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.

View File

@@ -70,9 +70,16 @@ enabled:
:variable:`CMAKE_<LANG>_COMPILER_VERSION`
The version of the compiler.
:variable:`CMAKE_<LANG>_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_<LANG>_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

View File

@@ -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