From c003a21a8fc1849e3661d6b7b996a26ae8edaea8 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Tue, 22 Nov 2016 09:50:41 +0000 Subject: [CMake] Fix determining the system libraries needed by LLVM from `llvm-config` when using LLVM 3.5 and newer. In newer versions of `llvm-config`, `--ldflags` doesn't give the system libraries anymore. Instead we need to use `--system-libs`. Issue reported by @ryosa . --- cmake/find_llvm.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake/find_llvm.cmake b/cmake/find_llvm.cmake index b1d3dc27..df730e12 100644 --- a/cmake/find_llvm.cmake +++ b/cmake/find_llvm.cmake @@ -149,7 +149,14 @@ else() string_to_list("${_llvm_libs}" _llvm_libs_list) # Now find the system libs that are needed. - _run_llvm_config(_system_libs "--ldflags") + if (${LLVM_PACKAGE_VERSION} VERSION_LESS "3.5") + # For LLVM 3.4 and older system libraries + # appeared in the output of `--ldflags`. + _run_llvm_config(_system_libs "--ldflags") + # TODO: Filter out `-L` flag. + else() + _run_llvm_config(_system_libs "--system-libs") + endif() string_to_list("${_system_libs}" _system_libs_list) # Create an imported target for each LLVM library -- cgit 1.4.1