[CMake] Mixed linking

Stephen Kelly steveire at gmail.com
Fri Feb 6 13:24:40 EST 2015


Norbert Pfeiler wrote:

>>
>> But I just don't know how to include the plugins.  Actually, I always get
>> the error about the platform plugin (cocoa in my case).  Any tips ?
> 
> 
> For Windows it’s like this:
> 
> #if defined(Q_OS_WIN) && defined(QT_STATIC)
> #include <QtPlugin>
> Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
> #endif

Ah, right the platform plugin issue. This is likely the reason for not 
running on OSX.

CMake 3.1 learned a new feature specifically so that this would become 
easier in the future:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/7970

qmake generates a file like the above for you and compiles it and links it 
into your application for you in the static version.

With 

 http://www.cmake.org/cmake/help/v3.1/prop_tgt/INTERFACE_SOURCES.html

Qt can do the same, but someone would have to patch Qt to do so. Something 
for the future... :)

Thanks,

Steve.




More information about the CMake mailing list