On 09/02/2010 12:13 AM, Andreas Pakulat wrote:
> Hi,
> 
> I've got a small problem here, I'm building an installing a static
> library which links (among other things) against QtCore. I'm also using
> the cmake install(TARGETS .. EXPORT) stuff to export a Target.cmake file
> with the library as imported target. Last but not least this lib has
> some deps in its public API and hence I'm using LINK_INTERFACE_LIBRARIES
> to add those. Unfortunately for some reason QtCore is also added which
> I'd like to avoid (as it creates a dependency upon an absolute path to
> Qt in the installed stuff). I've already tried setting the target
> property to "", but its still added automatically by cmake.

Consider to set QT_USE_IMPORTED_TARGETS to TRUE before invoking the
FIND_PACKAGE(Qt4 ...) command; this will replace the absolute paths
in the targets file with imported targets for the Qt libraries, but
read FindQt4.cmake's documentation w.r.t. QT_USE_IMPORTED_TARGETS
for the related implications.

> Anybody knows of something in cmake that would explain this?

AFAIK, it's TARGET_LINK_LIBRARIES(<static-library> ${QT_QTCORE_LIBRARY})
that is causing the library's dependency on QtCore in the targets file.
Though QtCore isn't needed to create the library - as Alex has pointed
out in the meantime - this enables CMake to track dependencies. You may
leave out the above-mentioned TARGET_LINK_LIBRARIES() as this would not
prevent the library's creation, but it breaks the dependency graph, i.e.
a depender isn't linked automatically against QtCore anymore.

Regards,

Michael
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to