[CMake] Dependency paths in CMake package config files

Stephen Kelly steveire at gmail.com
Sun Oct 5 14:55:33 EDT 2014


Ruslan Baratov via CMake wrote:

>> So my question is, in general, how can I make installabled static
>> libraries with a package config file?  Or is the trying to redistribute
>> static libraries a bad idea in the first place?
> It's not related to static/shared, this is about absolute path. If you
> have an absolute path for dynamic library in FooConfig.cmake you'll have
> the same issue.

The solution is IMPORTED targets in the INTERFACE_LINK_LIBRARIES and a 
find_package to define the IMPORTED target on the consumer system.

I don't know if that works as well for static libraries, because you'd 
probably need to ensure that the exact same file is linked to by the 
consumer, which is not the case with shared libraries - as long as the API 
is the same, you could link to another version.

Thanks,

Steve.




More information about the CMake mailing list