[CMake] Mixed linking

Norbert Pfeiler norbert.pfeiler+cmake at gmail.com
Fri Feb 6 18:24:54 EST 2015


>
> Norbert Pfeiler wrote:
> > Currently you have to define »QT_STATIC«
> You shouldn't need to do this. If you use MSYS2's
> mingw-w64-{i686,x86_64}-qt5-static then that will be defined for you.


I have both *-qt5 (for dev) and *-qt5-static (for deploy) installed and
append the root of qt5-static to CMAKE_PREFIX_PATH for cmake to prefer the
static to the shared version.
QT_STATIC is not defined in this case.

Norbert Pfeiler wrote:
> > For Windows it’s like this:
> >
> > #if defined(Q_OS_WIN) && defined(QT_STATIC)
> > #include <QtPlugin>
> > Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
> > #endif
> Again, if you use MSYS2's mingw-w64-{i686,x86_64}-cmake then you
> should not need to do this either, because of


This is also not the case in the configuration above.
I don’t have to explicitly link the platform plugin though (after adding
Q_IMPORT_PLUGIN).

These 2 additions are way less of a hassle than having to rename *.lib to
*.a in all the qt cmake files and explicitly specifying all transitive qt
link deps, which was necessary before.
So thanks for your work.

Looking forward to:

> > They should mix fine.


Best, Norbert.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150207/4d267088/attachment.html>


More information about the CMake mailing list