Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to use CMake to build a Qt Plugin ?
Qt 6.11 is out! See what's new in the release blog

How to use CMake to build a Qt Plugin ?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mistralegnaM Offline
    mistralegnaM Offline
    mistralegna
    wrote on last edited by mistralegna
    #1

    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:

    1. To use qt5_wrap_cpp with the headers declaring the macro Q_OBJECT
    2. To set CMAKE_AUTOMOC to ON
    3. To set AUTOMOC to ON

    All of these always end with the same error (Parse error at IID).

    Thank you for your time!

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved