Important: Please read the Qt Code of Conduct -

Create a C++ plugin: how to install headers?

  • Hi!
    I've written a plugin following this guide, and now I've something perfectly working that I can instantiate from qml.
    The last building step install the file .so in default qml dir of qt.
    However, I would like to install it as a "library" as well. I can explain my case: I need to create one of the object defined in the plugin from the c++ code of another project, and in order to do it, I need the header and the relative library to be placed in QT_INSTALL_HEADERS and QT_INSTALL_LIBS.

    How can I setup the project to build the plugin as both "QML plugin" and "library like"?

    From this,
    it's seems that I've to add to the .pro these lines:

    headersDataFiles.path = $$[QT_INSTALL_HEADERS]/MyLib/
    headersDataFiles.files = $$PWD/src/*.h
    INSTALLS += headersDataFiles

    libraryFiles.path = $$[QT_INSTALL_LIBS]
    Debug:libraryFiles.files = $$OUT_PWD/debug/.a $$OUT_PWD/debug/.prl
    Release:libraryFiles.files = $$OUT_PWD/release/.a $$OUT_PWD/release/.prl
    INSTALLS += libraryFiles

    Is it the right procedure?


    This is the code of the plugin

Log in to reply