CMAKE_LINKER_TYPEΒΆ
New in version 3.29.
Specify which linker will be used for the link step.
Note
It is assumed that the linker specified is fully compatible with the standard one. CMake will not do any options translation.
This variable is used to initialize the LINKER_TYPE
target
property when they are created by calls to add_library()
or
add_executable()
commands. It is meaningful only for targets having a
link step. If set, its value is also used by the try_compile()
command.
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:
DEFAULT
This type corresponds to standard linking, essentially equivalent to not specifying
LINKER_TYPE
target property.SYSTEM
Use the standard linker delivered by the platform or the standard toolkit (for example,
SYSTEM
imply Microsoft linker for allMSVC
compatible compilers). This type is supported for the following platforms/compilers:Linux, for
GNU
,Clang
,LLVMFlang
andNVIDIA
compilers.All Apple variants for
AppleClang
,Clang
andGNU
compilers.Windows, for
MSVC
,GNU
,Clang
andNVIDIA
compilers.
LLD
Use the
LLVM
linker. This type is supported for the following platforms/compilers:Linux, for
GNU
,Clang
,LLVMFlang
andNVIDIA
compilers.All Apple variants for
Clang
andAppleClang
compilers.Windows, for
GNU
,Clang
compilers withGNU
front-end andCLang
,MSVC
andNVIDIA
compilers withMSVC
front-end.
BFD
Use the
GNU
linker. This type is supported for the following platforms/compilers:Linux, for
GNU
,Clang
,LLVMFlang
andNVIDIA
compilers.Windows, for
GNU
,Clang
compilers withGNU
front-end.
GOLD
Supported on Linux platform for
GNU
,Clang
,LLVMFlang
andNVIDIA
compilers.MOLD
Use the mold linker. This type is supported on the following platforms:
Linux platform for
GNU
,Clang
,LLVMFlang
andNVIDIA
compilers.All Apple variants for
Clang
andAppleClang
compilers as an alias toSOLD
.
SOLD
Use the sold linker. This type is only supported on Apple platforms for
Clang
andAppleClang
compilers.APPLE_CLASSIC
Use the Apple linker in the classic behavior (i.e. before
Xcode 15.0
). This type is only supported on Apple platforms forGNU
,Clang
andAppleClang
compilers.MSVC
Use the Microsoft linker. This type is only supported on Windows platform for
MSVC
andClang
compiler withMSVC
front-end.