`CMAKE_LINKER` does not do what it is thought to do
Intuitively when one sets CMAKE_LINKER
, one expects that it will be used as the default linker for all languages. But that's not true because the toolchains prefer to use the compiler for the linker. Thus one has to define the linker liker by setting linker flags like -fuse-ld=lld
.
It would be preferred instead if the toolchain files can check CMAKE_LINKER
and automatically add the appropriate flag for the compiler to use what linker was specified there.
Edit: I wanted to add some reference about CMAKE_LINKER
documentation, but I do not see any. I don't remember where I originally got the impression of using that variable (maybe from the CMakeCache.txt?). Is there some history around that variable?
Edited by Cristian Le