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)
|
LIST(GET COMPILER_VERSION_LIST 0 COMPILER_VERSION_MAJOR)
|
||||||
|
|
||||||
option (LINKER_NAME "Linker name or full path")
|
option (LINKER_NAME "Linker name or full path")
|
||||||
find_program (LLD_PATH NAMES "ld.lld" "lld" "lld-${COMPILER_VERSION_MAJOR}")
|
if (COMPILER_GCC)
|
||||||
find_program (GOLD_PATH NAMES "ld.gold" "gold")
|
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.
|
# We prefer LLD linker over Gold or BFD.
|
||||||
|
|
||||||
if (NOT LINKER_NAME)
|
if (NOT LINKER_NAME)
|
||||||
if (LLD_PATH)
|
if (LLD_PATH)
|
||||||
# GCC driver requires one of supported linker names like "lld".
|
|
||||||
# Clang driver simply allows full linker path.
|
|
||||||
|
|
||||||
if (COMPILER_GCC)
|
if (COMPILER_GCC)
|
||||||
get_filename_component(LLD_BASENAME ${LLD_PATH} NAME)
|
# GCC driver requires one of supported linker names like "lld".
|
||||||
if (LLD_BASENAME STREQUAL ld.lld)
|
set (LINKER_NAME "lld")
|
||||||
set (LINKER_NAME "lld")
|
|
||||||
endif ()
|
|
||||||
else ()
|
else ()
|
||||||
|
# Clang driver simply allows full linker path.
|
||||||
set (LINKER_NAME ${LLD_PATH})
|
set (LINKER_NAME ${LLD_PATH})
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
@ -48,10 +48,7 @@ endif ()
|
|||||||
if (NOT LINKER_NAME)
|
if (NOT LINKER_NAME)
|
||||||
if (GOLD_PATH)
|
if (GOLD_PATH)
|
||||||
if (COMPILER_GCC)
|
if (COMPILER_GCC)
|
||||||
get_filename_component(GOLD_BASENAME ${GOLD_PATH} NAME)
|
set (LINKER_NAME "gold")
|
||||||
if (GOLD_BASENAME STREQUAL ld.gold)
|
|
||||||
set (LINKER_NAME "gold")
|
|
||||||
endif ()
|
|
||||||
else ()
|
else ()
|
||||||
set (LINKER_NAME ${GOLD_PATH})
|
set (LINKER_NAME ${GOLD_PATH})
|
||||||
endif ()
|
endif ()
|
||||||
|
Loading…
Reference in New Issue
Block a user