Help: Grammar, typos and wording improvements for linker variables

This commit is contained in:
Craig Scott 2024-03-26 08:02:46 +11:00
parent 5b21897c6e
commit aecea7b28b
No known key found for this signature in database
GPG Key ID: 6FF37CBDCCADED9F
5 changed files with 24 additions and 27 deletions

View File

@ -6,16 +6,13 @@ CMAKE_<LANG>_COMPILER_LINKER_FRONTEND_VARIANT
Identification string of the linker frontend variant. Identification string of the linker frontend variant.
Some linkers have multiple, different frontends for accepting command Some linkers have multiple, different frontends for accepting command
line options. (For example ``LLCM LLD`` originally only had a frontend line options. For example, ``LLVM LLD`` originally only had a frontend
compatible with the ``GNU`` compiler but since its port to Windows compatible with the ``GNU`` compiler, but since its port to Windows
(``lld-link``) it now also supports a frontend compatible with ``MSVC``.) (``lld-link``), it now also supports a frontend compatible with ``MSVC``.
When CMake detects such a linker it sets this variable to what would have been When CMake detects such a linker, it sets this variable to what would have been
the :variable:`CMAKE_<LANG>_COMPILER_LINKER_ID` for the linker whose frontend the :variable:`CMAKE_<LANG>_COMPILER_LINKER_ID` for the linker whose frontend
it resembles. it resembles.
.. note:: .. note::
In other words, this variable describes what command line options In other words, this variable describes what command line options
and language extensions the linker frontend expects. and language extensions the linker frontend expects.
This variable is set for ``GNU``, ``MSVC``, ``MOLD`` and ``AppleClang``
linkers that have only one frontend variant.

View File

@ -17,8 +17,8 @@ Value Name
``bfd``) ``bfd``)
``GNUgold`` `GNU Binutils - gold linker`_ ``GNUgold`` `GNU Binutils - gold linker`_
``MSVC`` `Microsoft Visual Studio`_ ``MSVC`` `Microsoft Visual Studio`_
``MOLD`` `mold: A Modern Linker`_ or, on Apple, `sold`_ ``MOLD`` `mold: A Modern Linker`_, or on Apple the
linker `sold`_ linker
``AIX`` AIX system linker ``AIX`` AIX system linker
``Solaris`` SunOS system linker ``Solaris`` SunOS system linker
=============================== =============================================== =============================== ===============================================

View File

@ -3,8 +3,8 @@ CMAKE_<LANG>_USING_LINKER_MODE
.. versionadded:: 3.29 .. versionadded:: 3.29
This variable specify what is the type of data stored in variable This controls how the value of the :variable:`CMAKE_<LANG>_USING_LINKER_<TYPE>`
:variable:`CMAKE_<LANG>_USING_LINKER_<TYPE>`. There are two possible values: variable should be interpreted. The supported linker mode values are:
``FLAG`` ``FLAG``
:variable:`CMAKE_<LANG>_USING_LINKER_<TYPE>` holds compiler flags. This is :variable:`CMAKE_<LANG>_USING_LINKER_<TYPE>` holds compiler flags. This is

View File

@ -3,32 +3,32 @@ CMAKE_<LANG>_USING_LINKER_<TYPE>
.. versionadded:: 3.29 .. versionadded:: 3.29
This variable defines how to specify the linker for the link step for the type This variable defines how to specify the ``<TYPE>`` linker for the link step,
as specified by the variable :variable:`CMAKE_LINKER_TYPE` or the target as controlled by the :variable:`CMAKE_LINKER_TYPE` variable or the
property :prop_tgt:`LINKER_TYPE`. It can hold compiler flags for the link step :prop_tgt:`LINKER_TYPE` target property. Depending on the value of the
or directly the linker tool. The type of data is given by the variable :variable:`CMAKE_<LANG>_USING_LINKER_MODE` variable,
:variable:`CMAKE_<LANG>_USING_LINKER_MODE`. ``CMAKE_<LANG>_USING_LINKER_<TYPE>`` can hold compiler flags for the link step,
or flags to be given directly to the linker tool.
.. note:: .. note::
The specified linker tool is expected to be accessible through The specified linker tool is generally expected to be accessible through
the ``PATH`` environment variable, particularly when the the ``PATH`` environment variable.
:variable:`CMAKE_<LANG>_USING_LINKER_MODE` variable is set to ``FLAG``.
For example, to specify the ``LLVM`` linker for ``GNU`` compilers, we have: For example, the ``LLD`` linker for ``GNU`` compilers is defined like so:
.. code-block:: cmake .. code-block:: cmake
set(CMAKE_C_USING_LINKER_LLD "-fuse-ld=lld") set(CMAKE_C_USING_LINKER_LLD "-fuse-ld=lld")
Or on ``Windows`` platform, for ``Clang`` compilers simulating ``MSVC``, we On the ``Windows`` platform with ``Clang`` compilers simulating ``MSVC``:
have:
.. code-block:: cmake .. code-block:: cmake
set(CMAKE_C_USING_LINKER_LLD "-fuse-ld=lld-link") set(CMAKE_C_USING_LINKER_LLD "-fuse-ld=lld-link")
And for the ``MSVC`` compiler, linker is directly used, so we have: And for the ``MSVC`` compiler, the linker is invoked directly, not via the
compiler frontend:
.. code-block:: cmake .. code-block:: cmake

View File

@ -9,9 +9,9 @@ Specify which linker will be used for the link step.
It is assumed that the linker specified is fully compatible with the standard It is assumed that the linker specified is fully compatible with the standard
one. CMake will not do any options translation. one. CMake will not do any options translation.
This variable is used to initialize the :prop_tgt:`LINKER_TYPE` target This variable is used to initialize the :prop_tgt:`LINKER_TYPE` property
property when they are created by calls to :command:`add_library` or on each target created by a call to :command:`add_library` or
:command:`add_executable` commands. It is meaningful only for targets having a :command:`add_executable`. It is meaningful only for targets having a
link step. If set, its value is also used by the :command:`try_compile` link step. If set, its value is also used by the :command:`try_compile`
command. command.