diff --git a/cmake/tools.cmake b/cmake/tools.cmake index 6aaeb5b8a16..8eccbfd9f83 100644 --- a/cmake/tools.cmake +++ b/cmake/tools.cmake @@ -32,29 +32,29 @@ else () find_program (GOLD_PATH NAMES "ld.gold" "gold") endif () -if (NOT OS_FREEBSD) -# We prefer LLD linker over Gold or BFD. - if (NOT LINKER_NAME) - if (LLD_PATH) - if (COMPILER_GCC) - # GCC driver requires one of supported linker names like "lld". - set (LINKER_NAME "lld") - else () - # Clang driver simply allows full linker path. - set (LINKER_NAME ${LLD_PATH}) +if (OS_LINUX) + # We prefer LLD linker over Gold or BFD on Linux. + if (NOT LINKER_NAME) + if (LLD_PATH) + if (COMPILER_GCC) + # GCC driver requires one of supported linker names like "lld". + set (LINKER_NAME "lld") + else () + # Clang driver simply allows full linker path. + set (LINKER_NAME ${LLD_PATH}) + endif () endif () endif () - endif () - if (NOT LINKER_NAME) - if (GOLD_PATH) - if (COMPILER_GCC) - set (LINKER_NAME "gold") - else () - set (LINKER_NAME ${GOLD_PATH}) + if (NOT LINKER_NAME) + if (GOLD_PATH) + if (COMPILER_GCC) + set (LINKER_NAME "gold") + else () + set (LINKER_NAME ${GOLD_PATH}) + endif () endif () endif () - endif () endif () if (LINKER_NAME)