Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Forum Updated on Feb 6th

    How to use CMake to build a Qt Plugin ?

    General and Desktop
    1
    1
    690
    Loading More Posts
    • 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.
    • mistralegna
      mistralegna last edited by mistralegna

      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 Reply Quote 0
      • First post
        Last post