[cmake-developers] Setting target properties before the target is defined ?
Brad King
brad.king at kitware.com
Wed Mar 27 10:00:57 EDT 2013
On 03/27/2013 09:32 AM, Stephen Kelly wrote:
> http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/35578/focus=35666
>
> All I know is that it doesn't seem to cause a build error for me when I
> export a target with LINK_PUBLIC Qt5::Core LINK_PRIVATE Qt5::Script and then
> have the caller only find Qt5Core and not Qt5Script.
>
> Would that be because libQt5Script.so.5 is in the same dir as libQt5Core.so.5
Yes, so the linker can find it there.
> and the Qt5::Script entry in LINK_DEPENDENT_LIBRARIES is ignored?
The Qt5::Script entry in IMPORTED_LINK_DEPENDENT_LIBRARIES_<CONFIG> will
be skipped by cmComputeLinkInformation::AddSharedDepItem if it is not an
available target name because it is not a full path.
When generating the Qt5 imported targets if you know dependencies will
be in the same directory then you can just leave them out of the
IMPORTED_LINK_DEPENDENT_LIBRARIES_<CONFIG> property altogether.
> Also, when building the executable, the link line contains the full path to
> Qt5Core, and -Wl,-rpath,/path/to/qt5prefix/lib. Maybe that's what makes it
> work for me either?
The -rpath option will not help at link time, only -rpath-link.
The above explains why it works though.
> At any rate, changing this to be a fatal error should at least come with a
> policy, no?
Yes. However, I'm also fine with just leaving out implementation
dependencies from the feature proposed in this thread because the
conditions under which there will be a link-time error due to the
missing target are quite obscure.
-Brad
More information about the cmake-developers
mailing list