[cmake-developers] Setting target properties before the target is defined ?

Brad King brad.king at kitware.com
Wed Mar 27 09:08:50 EDT 2013


On 03/27/2013 08:54 AM, Stephen Kelly wrote:
> Brad King <brad.king at ...> writes:
>> the iface->SharedDeps list needs to be included in
>> IMPORTED_LINK_INTERFACE_TARGETS_≤CONFIG> also.
> 
> The problem with this is that it will break working code. Not-found entries in
> the LINK_DEPENDENT_LIBRARIES do not currently cause a build error. The only
> effect (as far as I know) is that the target location is not available for
> generating the correct RPATH information, which downstreams may or may not use. 

It's not for -rpath, it's for -rpath-link.  They are different.

See the example here for how it can cause a build error in downstreams:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/35578/focus=35666

> I also find it unfortunate that the internal implementation detail dependencies
> of a package would need to be found by the package. Eg, if I have 
> 
>   IMPORTED_LINK_DEPENDENT_LIBRARIES_RELWITHDEBINFO "Qt5::Script"
>   IMPORTED_LINK_INTERFACE_LIBRARIES_RELWITHDEBINFO "Qt5::Core"
> 
> in MyTarget, then MyTargetConfig.cmake will have to find_package(Qt5Script),
> even though callers only need that to be found if they want the RPATH
> information from it. Is there a better solution?

Fix linkers to not need implementation dependencies of a shared library
when linking to it?  I presume there is a reason linkers need this.

CMake is merely propagating this linking requirement, not adding it.
The feature proposed in this discussion is about erroring-out at CMake
time instead of link time.

-Brad



More information about the cmake-developers mailing list