llvm.org GIT mirror llvm / 228b83b
[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! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316956 91177308-0d34-0410-b5e6-96231b3b80d8 Tim Shen 1 year, 11 months ago
1 changed file(s) with 6 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
149149 if(NOT WIN32 AND NOT APPLE)
150150 # Detect what linker we have here
152 set(command ${CMAKE_C_COMPILER} -fuse-ld=${LLVM_USE_LINKER} -Wl,--version)
153 else()
154 set(command ${CMAKE_C_COMPILER} -Wl,--version)
155 endif()
151156 execute_process(
152 COMMAND ${CMAKE_C_COMPILER} -Wl,--version
157 COMMAND ${command}
153158 OUTPUT_VARIABLE stdout
154159 ERROR_VARIABLE stderr
155160 )