[Interest] CMake AUTOMOC & Windows linking
Andy
asmaloney at gmail.com
Fri May 15 17:17:49 CEST 2020
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.
- Dynamic Library (Plugin) "B":
Uses target_link_libraries( B "A" ) to include "A".
When compiling with MSVC (on CI), I have a link problem:
PLUGIN_B_autogen\4RG5PT7PRG/moc_Foo.cpp(75): warning C4273:
'Foo::qt_static_metacall': inconsistent dll linkage
LibraryA\include\Foo.h(30): note: see previous definition of
'qt_static_metacall'
PLUGIN_B_autogen\4RG5PT7PRG/moc_Foo.cpp(111): error C2491:
'Foo::staticMetaObject': definition of dllimport static data member not
allowed
1) This setup was working before I added a class with Q_OBJECT & signals to
"A"
2) It looks like I'm getting Foo's static meta object compiled into both
"A" and "B". Is this what should be happening?
I feel like I'm missing something obvious...
---
Andy Maloney // https://asmaloney.com
twitter ~ @asmaloney <https://twitter.com/asmaloney>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200515/bf3c0e36/attachment.html>
More information about the Interest
mailing list