Add way to choose linker like gold, lld, mold
CMake does not offer a convenient way to
- detect available linker
- select another linker then the default linker.
CMake currently uses the default linker (ld on Linux) and does not offer a plattform- and compiler-independent way to choose an alternative linker like gold, lld, or mold (or any macOS, BSD, Windows alternative linker).
For some compiler like g++ and Clang, one can use "-fuse-ld=lld", but setting the path to a user-defined linker location (like /home/ for locally compiled version) is non-trivial.
I would like to get a similar way to how compilers are chosen by defining CMAKE_<lang>_COMPILER
.