mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-11 17:02:25 +00:00
Fixed linker searching logic.
This commit is contained in:
parent
e7540dcf68
commit
a3fd3bfd15
@ -24,22 +24,22 @@ STRING(REGEX MATCHALL "[0-9]+" COMPILER_VERSION_LIST ${CMAKE_CXX_COMPILER_VERSIO
|
||||
LIST(GET COMPILER_VERSION_LIST 0 COMPILER_VERSION_MAJOR)
|
||||
|
||||
option (LINKER_NAME "Linker name or full path")
|
||||
find_program (LLD_PATH NAMES "ld.lld" "lld" "lld-${COMPILER_VERSION_MAJOR}")
|
||||
find_program (GOLD_PATH NAMES "ld.gold" "gold")
|
||||
if (COMPILER_GCC)
|
||||
find_program (LLD_PATH NAMES "ld.lld")
|
||||
find_program (GOLD_PATH NAMES "ld.gold")
|
||||
else ()
|
||||
find_program (LLD_PATH NAMES "ld.lld-${COMPILER_VERSION_MAJOR}" "lld-${COMPILER_VERSION_MAJOR}" "ld.lld" "lld")
|
||||
find_program (GOLD_PATH NAMES "ld.gold" "gold")
|
||||
endif ()
|
||||
|
||||
# We prefer LLD linker over Gold or BFD.
|
||||
|
||||
if (NOT LINKER_NAME)
|
||||
if (LLD_PATH)
|
||||
# GCC driver requires one of supported linker names like "lld".
|
||||
# Clang driver simply allows full linker path.
|
||||
|
||||
if (COMPILER_GCC)
|
||||
get_filename_component(LLD_BASENAME ${LLD_PATH} NAME)
|
||||
if (LLD_BASENAME STREQUAL ld.lld)
|
||||
# GCC driver requires one of supported linker names like "lld".
|
||||
set (LINKER_NAME "lld")
|
||||
endif ()
|
||||
else ()
|
||||
# Clang driver simply allows full linker path.
|
||||
set (LINKER_NAME ${LLD_PATH})
|
||||
endif ()
|
||||
endif ()
|
||||
@ -48,10 +48,7 @@ endif ()
|
||||
if (NOT LINKER_NAME)
|
||||
if (GOLD_PATH)
|
||||
if (COMPILER_GCC)
|
||||
get_filename_component(GOLD_BASENAME ${GOLD_PATH} NAME)
|
||||
if (GOLD_BASENAME STREQUAL ld.gold)
|
||||
set (LINKER_NAME "gold")
|
||||
endif ()
|
||||
else ()
|
||||
set (LINKER_NAME ${GOLD_PATH})
|
||||
endif ()
|
||||
|
Loading…
Reference in New Issue
Block a user