SUBDIRS template with common libraries used in multiple projects



  • Dear all,

    I have the following directory layout for my three independent Qt applications:

    |---> app1

    |---> app2

    |---> app3

    |---> myCommonLib

    All three applications are using myCommonLib. I would like to use the SUBDIRS template for my individual project files. The project file for app1 looks as follows:

    @
    TEMPLATE = subdirs

    SUBDIRS = app1 myCommonLib

    app1.file = ./app1.pro
    myCommonLib.file = ../myCommonLib/myCommonLib.pro

    app1.depends = myCommonLib
    @

    This works fine and I can build the project. However, as I am using "Shadow Build", Qt Creator will create the build folder of myCommonLib outside of my "Shadow Build folder". I guess this is because of the relative path. I understand that the "SUBDIRS"-Template might only be suitable for projects which actually do consist of subdirectories. That's not the case in my directory-layout, as myCommonLib is not a subdirectory of app1.

    However, is there a way how I can prevent Qt Creator from creating the build-files for myCommonLib outside the actual "Shadow-Build-directory"?

    Thanks in advance and with best regards,

    Markus Franke


  • Lifetime Qt Champion

    Hi,

    What's the pro file of myCommonLib ?



  • Well, it's just a normal project file starting with

    @TEMPLATE = lib
    CONFIG += staticlib@


  • Lifetime Qt Champion

    I might have misunderstood your initial setup. So you have something like

    /GenericCodeFolder/
    ----app1/subdirs project
    ----app2/
    ----app3/
    ----commonlib/lib-project

    right ?



  • Hi, yes that's right.


  • Lifetime Qt Champion

    Then AFAIK, it's not a setup supported by the subdirs template. Two options I can see: make a real subdirs project with all your apps and commonLib in it or treat commonLib like other dev library and have it installed in a known place and link to it the usual way


Log in to reply
 

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