diff options
author | Shoaib Meenai <smeenai@fb.com> | 2018-04-26 06:04:46 +0000 |
---|---|---|
committer | Shoaib Meenai <smeenai@fb.com> | 2018-04-26 06:04:46 +0000 |
commit | 185e3b301589256077081c88db6674c91d2db176 (patch) | |
tree | 64f88cdc4940c70f3bf66ea3387c375b99149a4b /cmake | |
parent | 70356d01bed73ddb7d2acdac6c7ef80390ef6bed (diff) |
[cmake] Make linker detection take flags into account
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330924 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/AddLLVM.cmake | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index 08e0e77998b..a65b1ff423e 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -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} |