forked from lijiext/lammps
make check for alternate linke more restrictive: also check for linker binary.
This commit is contained in:
parent
729cc81f31
commit
d09d40af9d
|
@ -23,14 +23,17 @@ if(ENABLE_TESTING)
|
|||
OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
||||
include(CheckCXXCompilerFlag)
|
||||
set(CMAKE_CUSTOM_LINKER_DEFAULT default)
|
||||
check_cxx_compiler_flag(-fuse-ld=lld HAVE_LLD_LINKER)
|
||||
check_cxx_compiler_flag(-fuse-ld=gold HAVE_GOLD_LINKER)
|
||||
check_cxx_compiler_flag(-fuse-ld=bfd HAVE_BFD_LINKER)
|
||||
if(HAVE_LLD_LINKER)
|
||||
check_cxx_compiler_flag(-fuse-ld=lld HAVE_LLD_LINKER_FLAG)
|
||||
check_cxx_compiler_flag(-fuse-ld=gold HAVE_GOLD_LINKER_FLAG)
|
||||
check_cxx_compiler_flag(-fuse-ld=bfd HAVE_BFD_LINKER_FLAG)
|
||||
find_program(HAVE_LLD_LINKER_BIN lld ld.lld)
|
||||
find_program(HAVE_GOLD_LINKER_BIN ld.gold)
|
||||
find_program(HAVE_BFD_LINKER_BIN ld.bfd)
|
||||
if(HAVE_LLD_LINKER_FLAG AND HAVE_LLD_LINKER_BIN)
|
||||
set(CMAKE_CUSTOM_LINKER_DEFAULT lld)
|
||||
elseif(HAVE_GOLD_LINKER)
|
||||
elseif(HAVE_GOLD_LINKER_FLAG AND HAVE_GOLD_LINKER_BIN)
|
||||
set(CMAKE_CUSTOM_LINKER_DEFAULT gold)
|
||||
elseif(HAVE_BFD_LINKER)
|
||||
elseif(HAVE_BFD_LINKER_FLAG AND HAVE_BFD_LINKER_BIN)
|
||||
set(CMAKE_CUSTOM_LINKER_DEFAULT bfd)
|
||||
endif()
|
||||
set(CMAKE_CUSTOM_LINKER_VALUES lld gold bfd default)
|
||||
|
|
Loading…
Reference in New Issue