Skip to content

Commit

Permalink
[cmake] Make linker detection take flags into account
Browse files Browse the repository at this point in the history
LLVM might be compiled using a toolchain file which controls the linker
to use via flags (e.g. `-B` or `-fuse-ld=`). Take these flags into
account for linker detection. We can also correct the detection by
manually passing LLVM_USE_LINKER, of course, but it seems more
convenient to have the detection take flags into account.

Differential Revision: https://reviews.llvm.org/D45464

llvm-svn: 330924
  • Loading branch information
smeenai committed Apr 26, 2018
1 parent e95bde3 commit fd7befa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion llvm/cmake/modules/AddLLVM.cmake
Expand Up @@ -152,7 +152,8 @@ if(NOT WIN32 AND NOT APPLE)
if( LLVM_USE_LINKER )
set(command ${CMAKE_C_COMPILER} -fuse-ld=${LLVM_USE_LINKER} -Wl,--version)
else()
set(command ${CMAKE_C_COMPILER} -Wl,--version)
separate_arguments(flags UNIX_COMMAND "${CMAKE_EXE_LINKER_FLAGS}")
set(command ${CMAKE_C_COMPILER} ${flags} -Wl,--version)
endif()
execute_process(
COMMAND ${command}
Expand Down

0 comments on commit fd7befa

Please sign in to comment.