mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Merge pull request #8139 from excitoon-favorites/better-linking
Fixed linker searching logic
This commit is contained in:
commit
08d59890ae
@ -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)
|
||||
set (LINKER_NAME "lld")
|
||||
endif ()
|
||||
# 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 ()
|
||||
@ -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 ()
|
||||
set (LINKER_NAME "gold")
|
||||
else ()
|
||||
set (LINKER_NAME ${GOLD_PATH})
|
||||
endif ()
|
||||
|
Loading…
Reference in New Issue
Block a user