Important: Please read the Qt Code of Conduct -

How to add library to app dependency list in QtCreator?

  • I'm trying to create QtQuick extention, and can't understand, how I can add it to my app project, that it was compiling, picks, and for android, packing in one apk?

    I have next directory structure:
    TEMPLATE = subdirs

    SUBDIRS +=

    I try to open in QtCreator, both and opens, seems to be good. The .pro file with TEMPLATE = subdirs, as I understand, , is an analogue of MSVC solution. In MSVC, I can simply specify the dependency, and lib will be built before building exe, but in qtCreator I can't find such feature.

    I try to do as writes in net - open, right click on it, "Add library..." — "Internal library". In dialog "Choise the project file the library to link to" combobox is always empty, and I can't select my library.

    What I'm doing wrong?

  • If I understood it correctly, you have an application project in and a library project in

    Does contains ?
    TEMPLATE = lib

  • Yes, it does

    TEMPLATE = lib
    TARGET = filedialog
    QT += qml quick declarative
    CONFIG += qt plugin

    TARGET = $$qtLibraryTarget($$TARGET)
    uri = com.purefractalsolutions.gkdroidfiledialog
    # Input
    SOURCES += \
        dialogPlugin.cpp \
        directory.cpp \
    HEADERS += \
        dialogPlugin.h \
        directory.h \
    OTHER_FILES = qmldir
    !equals(_PRO_FILE_PWD_, $$OUT_PWD) { = $$OUT_PWD/qmldir
        copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir
        copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(, /, $$QMAKE_DIR_SEP)\"
        QMAKE_EXTRA_TARGETS += copy_qmldir
        PRE_TARGETDEPS += $$
    qmldir.files = qmldir
    unix {
        installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)
        qmldir.path = $$installPath
        target.path = $$installPath
        INSTALLS += target qmldir


Log in to reply