summaryrefslogtreecommitdiffstats
path: root/llvm/cmake/modules/AddLLVM.cmake
diff options
context:
space:
mode:
authorTim Shen <timshen91@gmail.com>2017-10-30 21:12:14 +0000
committerTim Shen <timshen91@gmail.com>2017-10-30 21:12:14 +0000
commit5a166048f0ba7c73762b1abb144cf20cfe7a69d9 (patch)
treeff8052a35de711dffe312119a263613f694c9ffc /llvm/cmake/modules/AddLLVM.cmake
parent9f01f6093cef31a7c972e7ffc98f60964c4941ba (diff)
downloadbcm5719-llvm-5a166048f0ba7c73762b1abb144cf20cfe7a69d9.tar.gz
bcm5719-llvm-5a166048f0ba7c73762b1abb144cf20cfe7a69d9.zip
[CMake] Fix linker detection in AddLLVM.cmake
Fix linker not being correctly detected when a custom one is specified through LLVM_USE_LINKER CMake variable. In particular, cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_LINKER=gold ../llvm resulted into Linker detection: GNU ld instead of Linker detection: GNU Gold due to the construction not accounting for such variable. It led to the general confusion and prevented setting linker-specific flags inside functions defined in AddLLVM.cmake. Thanks Oleksii Vilchanskyi for the patch! llvm-svn: 316956
Diffstat (limited to 'llvm/cmake/modules/AddLLVM.cmake')
-rw-r--r--llvm/cmake/modules/AddLLVM.cmake7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index f52b1c44ab2..62e264e5ef3 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -149,8 +149,13 @@ endfunction(add_llvm_symbol_exports)
if(NOT WIN32 AND NOT APPLE)
# Detect what linker we have here
+ if( LLVM_USE_LINKER )
+ set(command ${CMAKE_C_COMPILER} -fuse-ld=${LLVM_USE_LINKER} -Wl,--version)
+ else()
+ set(command ${CMAKE_C_COMPILER} -Wl,--version)
+ endif()
execute_process(
- COMMAND ${CMAKE_C_COMPILER} -Wl,--version
+ COMMAND ${command}
OUTPUT_VARIABLE stdout
ERROR_VARIABLE stderr
)
OpenPOWER on IntegriCloud