[CMake] [Q] LINK_INTERFACE_LIBRARIES and the like

Marcel Loose loose at astron.nl
Wed Dec 23 03:52:09 EST 2009


On Tue, 2009-12-22 at 16:22 +0100, Michael Wild wrote:
> On 22. Dec, 2009, at 15:52 , Marcel Loose wrote:
> 
> > Hi all,
> > 
> > After reading, re-reading, and re-re-reading the manual, I still don't
> > really get the concept of LINK_INTERFACE_LIBRARIES, 
> > IMPORTED_LINK_DEPENDENT_LIBRARIES, and
> > IMPORTED_LINK_INTERFACE_LIBRARIES. Is this mostly Windows-specific, or
> > does it also apply for Linux?
> > 
> > Best regards,
> > Marcel Loose.
> > 
> 
> LINK_INTERFACE_LIBRARIES is a property you can set if you want to override the set of libraries that appear in the link-interface of one of your own libraries.
> 
> IMPORTED_LINK_INTERFACE_LIBRARIES is the same for IMPORTED targets. E.g. suppose you have this:
> 
> add_library(foo ${FOO_SRCS})
> target_link_libraries(foo bar)
> install(EXPORT ${PROJECT_NAME}Dependencies DESTINATION <somewhere>)
> 
> The created <somewhere>/${PROJECT_NAME}Dependencies.cmake file will list "bar" in the LINK_INTERFACE_LIBRARIES of "foo". This property is essentially a copy of LINK_INTERFACE_LIBRARIES property of "foo" in the build tree (if it is defined).
> 
> 
> IMPORTED_LINK_DEPENDENT_LIBRARIES is AFAIK similar to IMPORTED_LINK_INTERFACE_LIBRARIES but refers to dependencies that are "implementation details".
> 
> 
> HTH
> 
> Michael
> 
Hi Michael,

That clarifies things a bit. Maybe I'm just not familiar enough with
import/export of libraries. Could I compare this
<somewhere>/${PROJECT_NAME}Dependencies.cmake file with the <package>.pc
file that is generated by pkg-config as a means to record compile and
link flags?

Another question: is it common good practice for a CMake-project to
export its public libraries using install(EXPORT...), or would you do
that on a case-to-case basis?

Would there be a use case for LINK_INTERFACE_LIBRARIES within one
project, to relate several libraries within that project?

Best regards,
Marcel Loose.





More information about the CMake mailing list