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:
    @dev_root
    all.pro
    app
    app.pro
    ext
    ext.pro
    @

    all.pro:
    @
    TEMPLATE = subdirs

    SUBDIRS +=
    app
    ext
    @

    I try to open all.pro in QtCreator, both app.pro and ext.pro 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 app.pro, 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 app.pro and a library project in ext.pro.

    Does ext.pro 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 \
        file.cpp
    
    HEADERS += \
        dialogPlugin.h \
        directory.h \
        file.h
    
    OTHER_FILES = qmldir
    
    !equals(_PRO_FILE_PWD_, $$OUT_PWD) {
        copy_qmldir.target = $$OUT_PWD/qmldir
        copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir
        copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\"
        QMAKE_EXTRA_TARGETS += copy_qmldir
        PRE_TARGETDEPS += $$copy_qmldir.target
    }
    
    qmldir.files = qmldir
    unix {
        installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)
        qmldir.path = $$installPath
        target.path = $$installPath
        INSTALLS += target qmldir
    }   
    

    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.