Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [solved] Create top level QT project to build multiple projects

[solved] Create top level QT project to build multiple projects

Scheduled Pinned Locked Moved General and Desktop
pro filebuildmultiple
12 Posts 4 Posters 10.6k Views
  • 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.
  • C Offline
    C Offline
    code_fodder
    wrote on last edited by code_fodder
    #1

    I have two completely separate qt projects (maybe more in future):

    • \somewhere\qtProj1\
    • \somewhere\qtProj2\

    However they are both a part of a larger system, so I want to create a "top-level" project that is only there to build the various projects and copy the various outputs to a single location. I would like to end up with:

    • \somewhere\qtMain\ (this project may just contain a .pro file - not really sure)
    • \somewhere\qtProj1\
    • \somewhere\qtProj2\

    So the idea is, that I open qtMain, select the build type (debug, release, etc...) and the hit "build". It then builds all the referenced projects (i.e. qtProj1 and qtProj2) with the relevant CONFIG options.

    I looked at the Qt subdirs project, but this does not look like what I want. Is there some way to do this? In make/scons you just call the "sub projects" make/scons files. I just want something simple/basic.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      Hi,

      I suggest to use CMake for complex projects.

      At the moment I manage a big system composed by 10 executables and more than 300 Unit Test in a single CMake projects.

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      1
      • C Offline
        C Offline
        code_fodder
        wrote on last edited by
        #3

        Hi, thanks for that.

        My project is not very complicated as such and I never used CMake. I would prefer to do this in the Qt environment - but if its not possible then I will try CMake : )

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mcosta
          wrote on last edited by
          #4

          Hi,

          I don't know if with qMake is NOT POSSIBLE; for sure CMake is more flexible and powerful.

          The good thing about leaning CMake is that you can use it also for non-Qt projects

          Once your problem is solved don't forget to:

          • Mark the thread as SOLVED using the Topic Tool menu
          • Vote up the answer(s) that helped you to solve the issue

          You can embed images using (http://imgur.com/) or (http://postimage.org/)

          C 1 Reply Last reply
          0
          • T Offline
            T Offline
            t3685
            wrote on last edited by
            #5

            Have you looked at the "Subdirs project"? It might be what you are looking for.

            C 1 Reply Last reply
            1
            • M mcosta

              Hi,

              I don't know if with qMake is NOT POSSIBLE; for sure CMake is more flexible and powerful.

              The good thing about leaning CMake is that you can use it also for non-Qt projects

              C Offline
              C Offline
              code_fodder
              wrote on last edited by
              #6

              @mcosta Thanks for the advice, I will look into CMake : )

              1 Reply Last reply
              0
              • T t3685

                Have you looked at the "Subdirs project"? It might be what you are looking for.

                C Offline
                C Offline
                code_fodder
                wrote on last edited by
                #7

                @t3685 I mentioned in my original mail that subdirs project does not appear to be what I want (as far as I read about them and tested with them).

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  t3685
                  wrote on last edited by
                  #8

                  Unless I very misunderstood what you want, the subdirs project is you are looking for.
                  We have a Subdirs project, which consists of all the libraries we have + the applications which depend on them as sub-projects.
                  Sorry for not reading your first post properly by the way.

                  C 1 Reply Last reply
                  1
                  • T t3685

                    Unless I very misunderstood what you want, the subdirs project is you are looking for.
                    We have a Subdirs project, which consists of all the libraries we have + the applications which depend on them as sub-projects.
                    Sorry for not reading your first post properly by the way.

                    C Offline
                    C Offline
                    code_fodder
                    wrote on last edited by
                    #9

                    @t3685 No worries, I just didn't want you to think I had not done any research! ...

                    So I don't quite see how this works with sub-dirs project. I am not adding a new project and I am not adding a library - there does not seem to be an option to add an existing project. Can you show a link to an example?

                    All I want the "main" project to do is build a list of other projects with "CONFIG+=a b c"

                    In Sub Dirs project I can add libraries, or new projects I can't see how to do an existing one :(

                    T 1 Reply Last reply
                    0
                    • C code_fodder

                      @t3685 No worries, I just didn't want you to think I had not done any research! ...

                      So I don't quite see how this works with sub-dirs project. I am not adding a new project and I am not adding a library - there does not seem to be an option to add an existing project. Can you show a link to an example?

                      All I want the "main" project to do is build a list of other projects with "CONFIG+=a b c"

                      In Sub Dirs project I can add libraries, or new projects I can't see how to do an existing one :(

                      T Offline
                      T Offline
                      t3685
                      wrote on last edited by t3685
                      #10

                      @code_fodder

                      I took me a while to wrap me head around the Subdirs project at first. Basically the subdirs projects in a subdir project are just regular Qt qmake projects. The subdirs project itself is just a collection of those projects.

                      For example, say you have project A, B and C in folder "A", "B" and "C" with the following pro files "A.pro", "B.pro" and "C.pro". To create a subdirs project you move the folder "A", "B" and "C" to one folder (e.g. "Subdirs"). In "Subdirs" you make your subdirs pro file "Subdirs.pro".

                      In that profile you add:

                      TEMPLATE = subdirs
                      SUBDIRS = A \
                                B \
                                C
                      

                      When you build "Subdirs.pro", everything will be built. Hope this helps. By the way, check this link:

                      http://stackoverflow.com/questions/1417776/how-to-use-qmakes-subdirs-template

                      C 1 Reply Last reply
                      4
                      • T t3685

                        @code_fodder

                        I took me a while to wrap me head around the Subdirs project at first. Basically the subdirs projects in a subdir project are just regular Qt qmake projects. The subdirs project itself is just a collection of those projects.

                        For example, say you have project A, B and C in folder "A", "B" and "C" with the following pro files "A.pro", "B.pro" and "C.pro". To create a subdirs project you move the folder "A", "B" and "C" to one folder (e.g. "Subdirs"). In "Subdirs" you make your subdirs pro file "Subdirs.pro".

                        In that profile you add:

                        TEMPLATE = subdirs
                        SUBDIRS = A \
                                  B \
                                  C
                        

                        When you build "Subdirs.pro", everything will be built. Hope this helps. By the way, check this link:

                        http://stackoverflow.com/questions/1417776/how-to-use-qmakes-subdirs-template

                        C Offline
                        C Offline
                        code_fodder
                        wrote on last edited by code_fodder
                        #11

                        @t3685 ahhhh, so simple!, I was trying to use the wizards to add projects - it literally is just a .pro file with a list of sub-dirs where the next level of .pro files are! - I am sure they don't explain it in those simple terms in the docs : (

                        Thanks for persevering with your answer, up-voted accordingly : )

                        1 Reply Last reply
                        0
                        • KH-219DesignK Offline
                          KH-219DesignK Offline
                          KH-219Design
                          wrote on last edited by
                          #12

                          Another post recently linked back to this one, so I wanted to augment this with a couple more relevant links for setting up a manageable, maintainable qmake SUBDIRS structure:

                          https://www.toptal.com/qt/vital-guide-qmake

                          https://wiki.qt.io/QMake-top-level-srcdir-and-builddir

                          Which helped me set up a working example: https://github.com/219-design/qt-qml-project-template-with-ci/blob/6af6488d74e1dc97a/main_gui.pro

                          www.219design.com
                          Software | Electrical | Mechanical | Product Design

                          1 Reply Last reply
                          2

                          • Login

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