How to use CMake to build a Qt Plugin ?
Hello guys !
I would like to use CMake instead of QMake in order to build a Qt Plugin. The plugin is correctly built when I use QMake. However, when using CMake, I get the following error :
.../src/PluginName.hpp:16: Parse error at "IID"
Where this line is the following:
Q_PLUGIN_METADATA(IID "ID OF THE INTERFACE")
My header declares those three lines:
Q_OBJECT Q_PLUGIN_METADATA(IID "ID OF THE INTERFACE") Q_INTERFACES(NameOfTheInterface)
It seems that moc doesn't parse correctly the header. I think I don't pass the correct options to moc in my CMakeLists.txt.
In CMakeLists.txt, I already tried:
- To use qt5_wrap_cpp with the headers declaring the macro Q_OBJECT
- To set CMAKE_AUTOMOC to ON
- To set AUTOMOC to ON
All of these always end with the same error (Parse error at IID).
Thank you for your time!