[CMake] How to use LINK_INTERFACE_LIBRARIES

Lucas Soltic lucas.soltic at orange.fr
Sat May 24 18:35:42 EDT 2014


Le 24 mai 2014 à 18:45, Nils Gladitz <nilsgladitz at gmail.com> a écrit :
> 
>> On 24.05.2014 18:15, Lucas Soltic wrote:
>> Hello!
>> 
>> I'm having a hard time at properly using LINK_INTERFACE_LIBRARIES.
>> From what I understood, setting this property empty for a target avoids transitive dependencies linking.
>> 
>> But whatever I try, it doesn't work.
>> I have created a lib A linked against lib B.
>> I'm also creating an exe linked against lib A. But I really don't want it to be linked against lib B.
>> 
>> Till now I've tried
>> target_link_libraries(myexe A)
>> target_link_libraries(myexe LINK_INTERFACE_LIBRARIES "")
>> and
>> target_link_libraries(myexe A)
>> set_target_properties(myexe PROPERTIES LINK_INTERFACE_LIBRARIES "")
>> and
>> target_link_libraries(myexe LINK_INTERFACE_LIBRARIES A)
>> 
>> But in all these cases the exe gets linked against B :( (which causes loading issues due to RPATH stuff)
>> Does someone know how to use this property? (if it's the right one?)
>> 
>> Kind regards,
>> Lucas
> 
> target_link_libraries(A PRIVATE B) # A links to B but B is not added to the interface of A
> target_link_libraries(myexe A) # myexe links to A without B
> 
> Nils

Oh thank you so much that was it!


More information about the CMake mailing list