CMAKE_LINKER_TYPEΒΆ
New in version 3.29.
Specify which linker will be used for the link step.
This variable is used to initialize the LINKER_TYPE property
on each target created by a call to add_library() or
add_executable(). It is meaningful only for targets having a
link step. If set, its value is also used by the try_compile()
command.
Note
It is assumed that the linker specified is fully compatible with the default one the compiler would normally invoke. CMake will not do any option translation.
Linker types are case-sensitive and may only contain letters, numbers and underscores. Linker types defined in all uppercase are reserved for CMake's own built-in types. The pre-defined linker types are:
DEFAULTThis type corresponds to standard linking, essentially equivalent to the
LINKER_TYPEtarget property not being set at all.SYSTEMUse the standard linker provided by the platform or toolchain. For example, this implies the Microsoft linker for all MSVC-compatible compilers. This type is supported for the following platform-compiler combinations:
Linux:
GNU,Clang,LLVMFlang,NVIDIA, andSwiftcompilers.Apple platforms:
AppleClang,Clang,GNU, andSwiftcompilers.Windows:
MSVC,GNU,Clang,NVIDIA, andSwiftcompilers.
LLDUse the
LLVMlinker. This type is supported for the following platform-compiler combinations:Linux:
GNU,Clang,LLVMFlang,NVIDIA, andSwiftcompilers.Apple platforms:
Clang,AppleClang, andSwiftcompilers.Windows:
GNU,Clangwith MSVC-like front-end,Clangwith GNU-like front-end,MSVC,NVIDIAwith MSVC-like front-end, andSwift.
BFDUse the
GNUlinker. This type is supported for the following platform-compiler combinations:Linux:
GNU,Clang,LLVMFlang, andNVIDIAcompilers.Windows:
GNU,Clangwith GNU-like front-end.
GOLDSupported on Linux platform with
GNU,Clang,LLVMFlang,NVIDIA, andSwiftcompilers.MOLDUse the mold linker. This type is supported on the following platform-compiler combinations:
Linux:
GNU,Clang,LLVMFlang, andNVIDIAcompilers.Apple platforms:
ClangandAppleClangcompilers (acts as an alias to the sold linker).
SOLDUse the sold linker. This type is only supported on Apple platforms with
ClangandAppleClangcompilers.APPLE_CLASSICUse the Apple linker in the classic behavior (i.e. before
Xcode 15.0). This type is only supported on Apple platforms withGNU,Clang,AppleClang, andSwiftcompilers.MSVCUse the Microsoft linker. This type is only supported on the Windows platform with
MSVC,Clangwith MSVC-like front-end, andSwiftcompilers.