[Interest] CMake AUTOMOC & Windows linking

Matthew Woehlke mwoehlke.floss at gmail.com
Fri May 15 20:15:18 CEST 2020


On 15/05/2020 11.17, Andy wrote:
> I'm running into a link problem on Windows. I only have Windows on CI, so
> debugging this is... challenging.
> 
> - cmake 3.10+
> 
> - AUTOMOC is ON for the project in the top level cmake file
> 
> - Dynamic Library "A":
>    class LIB_IMPORT_EXPORT Foo
>    {
>        Q_OBJECT
>        ...
> 
>     where LIB_IMPORT_EXPORT uses Q_DECL_EXPORT/Q_DECL_IMPORT properly
> depending on who's building.

This isn't necessarily your problem, but if you're using CMake, I would 
recommend using generate_export_header to define your ABI decoration 
symbols rather than rolling your own using Q_DECL_EXPORT/Q_DECL_IMPORT.

-- 
Matthew


More information about the Interest mailing list