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

Brad King brad.king at kitware.com
Wed Sep 3 07:41:49 PDT 2014


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.

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.

-Brad




More information about the llvm-commits mailing list