[PATCH] [RFC] Interpreter: Set system libraries property for llvm-config

Johannes Löthberg via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 3 15:13:33 PST 2017


Fixes the missing -lffi in the llvm-config output when FFI is enabled.

Signed-off-by: Johannes Löthberg <johannes at kyriasis.com>
---
My first LLVM patch, so all comments welcome!

I was getting a bit tired of the ffi lib not being output
properly by llvm-config, so I copied the way that LLVMSupport
adds its system libs to system_libs.  Please let me know if
there's some other way to do this that would be preferred!

 lib/ExecutionEngine/Interpreter/CMakeLists.txt | 5 +++++
 tools/llvm-config/CMakeLists.txt               | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/ExecutionEngine/Interpreter/CMakeLists.txt b/lib/ExecutionEngine/Interpreter/CMakeLists.txt
index 7456b3dbe90..75c44a88f0c 100644
--- a/lib/ExecutionEngine/Interpreter/CMakeLists.txt
+++ b/lib/ExecutionEngine/Interpreter/CMakeLists.txt
@@ -15,6 +15,11 @@ add_llvm_library(LLVMInterpreter
   intrinsics_gen
   )
 
+set(system_libs)
+
 if( LLVM_ENABLE_FFI )
   target_link_libraries( LLVMInterpreter PRIVATE ${FFI_LIBRARY_PATH} )
+  set(system_libs ${system_libs} ffi)
 endif()
+
+set_property(TARGET LLVMInterpreter PROPERTY LLVM_SYSTEM_LIBS "${system_libs}")
diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt
index 5112648ea73..b7615d0e0c2 100644
--- a/tools/llvm-config/CMakeLists.txt
+++ b/tools/llvm-config/CMakeLists.txt
@@ -9,8 +9,9 @@ add_llvm_tool(llvm-config
   )
 
 # Compute the substitution values for various items.
-get_property(LLVM_SYSTEM_LIBS_LIST TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS)
-foreach(l ${LLVM_SYSTEM_LIBS_LIST})
+get_property(LLVM_SUPPORT_SYSTEM_LIBS_LIST TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS)
+get_property(LLVM_INTERPRETER_SYSTEM_LIBS_LIST TARGET LLVMInterpreter PROPERTY LLVM_SYSTEM_LIBS)
+foreach(l ${LLVM_SUPPORT_SYSTEM_LIBS_LIST} ${LLVM_INTERPRETER_SYSTEM_LIBS_LIST})
   if(MSVC)
     set(SYSTEM_LIBS ${SYSTEM_LIBS} "${l}.lib")
   else()
-- 
2.12.0



More information about the llvm-commits mailing list