[PATCH 1/1] build/cmake: Fix CMP0023 warning with libffi

Jan Vesely jan.vesely at rutgers.edu
Wed Sep 3 07:55:42 PDT 2014

On Wed, 2014-09-03 at 10:41 -0400, Brad King wrote:
> On 09/03/2014 05:26 AM, Dan Liew wrote:
> >>>> -  target_link_libraries( LLVMInterpreter ${FFI_LIBRARY_PATH} )
> >>>> +  target_link_libraries( LLVMInterpreter ${cmake_2_8_12_PRIVATE} ${FFI_LIBRARY_PATH} )
> > 
> > Shouldn't you be using ${cmake_2_8_12_INTERFACE} rather than
> > ${cmake_2_8_12_PRIVATE}? If you build using libffi presumably any
> > client of LLVM using the interpreter needs to link against it too
> > hence this library should end up in INTERFACE_LINK_LIBRARIES
> Unless LLVMInterpreter's header files make reference to libffi
> symbols such that application code including them might get
> direct references, then PRIVATE is the correct keyword.  You
> are telling CMake that the library has an implementation-only
> dependency on the ffi library.

thank you both for looking at this.
libffi is only  used in one file
(lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp) and it is never
part of the llvm interface.

> In the case that LLVMInterpreter is a static library CMake will
> still take care of linking dependents transitively to ffi.  It
> puts in INTERFACE_LINK_LIBRARIES a $<LINK_ONLY:ffi> generator
> expression that tells dependents of LLVMInterpreter that they
> need to link to the library but need no usage requirements
> from it.

I wondered how cmake handles link dependencies of static libraries.
thanks for the explanation.


> -Brad

Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140903/77d533e9/attachment.sig>

More information about the llvm-commits mailing list