# CMAKE_<LANG>_USING_LINKER_<TYPE>

Added in version 3.29.

This variable defines how to specify the `<TYPE>` linker for the link step, as controlled by the `CMAKE_LINKER_TYPE` variable or the `LINKER_TYPE` target property. Depending on the value of the `CMAKE_<LANG>_USING_LINKER_MODE` variable, `CMAKE_<LANG>_USING_LINKER_<TYPE>` can hold compiler flags for the link step, or flags to be given directly to the linker tool.

Note

The specified linker tool is generally expected to be accessible through the `PATH` environment variable.

For example, the `LLD` linker for `GNU` compilers is defined like so:

    set(CMAKE_C_USING_LINKER_LLD "-fuse-ld=lld")

On the `Windows` platform with `Clang` compilers simulating `MSVC`:

    set(CMAKE_C_USING_LINKER_LLD "-fuse-ld=lld-link")

And for the `MSVC` compiler, the linker is invoked directly, not via the compiler frontend:

    set(CMAKE_C_USING_LINKER_LLD "/path/to/lld-link.exe")
    set(CMAKE_C_USING_LINKER_MODE TOOL)

A custom linker type can also be defined, usually in a toolchain file:

    set(CMAKE_LINKER_TYPE lld_launcher)
    set(CMAKE_C_USING_LINKER_lld_launcher "-fuse-ld=/path/to/lld-launcher.sh")
    set(CMAKE_C_USING_LINKER_MODE FLAG)