Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. SUBDIRS template with common libraries used in multiple projects

SUBDIRS template with common libraries used in multiple projects

Scheduled Pinned Locked Moved Qt Creator and other tools
6 Posts 2 Posters 2.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    frankem
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What's the pro file of myCommonLib ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • F Offline
        F Offline
        frankem
        wrote on last edited by
        #3

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

        @TEMPLATE = lib
        CONFIG += staticlib@

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

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

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

          right ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • F Offline
            F Offline
            frankem
            wrote on last edited by
            #5

            Hi, yes that's right.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              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

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved