Unverified Commit d09d40af authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

make check for alternate linke more restrictive: also check for linker binary.

parent 729cc81f
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -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)