Library for all subproject



  • My project is divided into subprojects

    !http://i60.tinypic.com/2edmmnk.png(MYPRO)!

    Need to add a dynamic library that will be used by all subprojects. In the main project I selected [Add Library] and chose the library.

    Is this enough?

    Below my main project

    @TEMPLATE = subdirs

    SUBDIRS +=
    TecTrackerAdm
    TecTrackerOpr
    Core

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../DynamicQtWidgets/build/release/ -ldynamicqtwidgets
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../DynamicQtWidgets/build/debug/ -ldynamicqtwidgets
    else:unix: LIBS += -L$$PWD/../DynamicQtWidgets/build/ -ldynamicqtwidgets

    INCLUDEPATH += $$PWD/../DynamicQtWidgets/build
    DEPENDPATH += $$PWD/../DynamicQtWidgets/build
    @


  • Lifetime Qt Champion

    Hi,

    AFAIK no, but what you can do is create a pri file that contains the information to link to your library and include it in each project using it



  • Can also choose to perform the same procedure (Menu> Add Library) in each of the subprojects?

    You can leave an example of the solution with pri file?


  • Lifetime Qt Champion

    You can also, but if you have to modify e.g. the path to the library you'll to do it for all sub projects.

    @
    mylib.pri:

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../DynamicQtWidgets/build/release/ -ldynamicqtwidgets
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../DynamicQtWidgets/build/debug/ -ldynamicqtwidgets
    else:unix: LIBS += -L$$PWD/../DynamicQtWidgets/build/ -ldynamicqtwidgets

    INCLUDEPATH += $$PWD/../DynamicQtWidgets/build
    DEPENDPATH += $$PWD/../DynamicQtWidgets/build

    subprojectx.pri:
    include(../mylib.pri)
    @

    You may have to modify the path


Log in to reply
 

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