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. How to add two subdir project when empty qmake based project created ?
Forum Update on Monday, May 27th 2025

How to add two subdir project when empty qmake based project created ?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 224 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.
  • Q Offline
    Q Offline
    Qt embedded developer
    wrote on last edited by
    #1

    I have created one empty qmake based project

    whose content is empty

    like
    try1.pro

    // this is empty
    

    Now under this project i want to add two subdir project. what is way to add it ?

    Pl45m4P 1 Reply Last reply
    0
    • Q Qt embedded developer

      @Pl45m4 In that can you tell me how to add first subdir project's template as app and other subdir project as lib ?

      is there way to using qt creator though it's menu ?

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #4

      @Qt-embedded-developer said in How to add two subdir project when empty qmake based project created ?:

      In that can you tell me how to add first subdir project's template as app and other subdir project as lib ?

      Doesn't matter in terms of subdir. But if you have a library you need to link against it in your other project. Also make sure, that the library is built first.
      Therefore the option .depends, as you can see in the linked doc page.
      The pro file of the library has to be configured using shared or dll for a dynamic and staticor staticlib for a static library.
      Like

      my_lib.pro

      CONFIG += shared
      

      @Pl45m4 said in How to add two subdir project when empty qmake based project created ?:

      Easy to find out when reading the documentation ;-)

      it says:

      If you need to ensure that the subdirectories are built in a particular order, use the .depends modifier on the relevant SUBDIRS elements.

      For example:

      SUBDIRS += my_executable my_library tests doc
      
      my_executable.depends = my_library
      
      tests.depends = my_executable
      

      Another link:

      • https://doc.qt.io/qtcreator/creator-how-to-add-subprojects-to-projects.html

      and another one ;-)

      • https://wiki.qt.io/SUBDIRS_-_handling_dependencies

      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      3
      • Q Qt embedded developer

        I have created one empty qmake based project

        whose content is empty

        like
        try1.pro

        // this is empty
        

        Now under this project i want to add two subdir project. what is way to add it ?

        Pl45m4P Offline
        Pl45m4P Offline
        Pl45m4
        wrote on last edited by
        #2

        @Qt-embedded-developer said in How to add two subdir project when empty qmake based project created ?:

        Now under this project i want to add two subdir project. what is way to add it ?

        Easy to find out when reading the documentation ;-)

        • https://doc.qt.io/qt-6/qmake-variable-reference.html#subdirs

        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        Q 1 Reply Last reply
        1
        • Pl45m4P Pl45m4

          @Qt-embedded-developer said in How to add two subdir project when empty qmake based project created ?:

          Now under this project i want to add two subdir project. what is way to add it ?

          Easy to find out when reading the documentation ;-)

          • https://doc.qt.io/qt-6/qmake-variable-reference.html#subdirs
          Q Offline
          Q Offline
          Qt embedded developer
          wrote on last edited by Qt embedded developer
          #3

          @Pl45m4 In that can you tell me how to add first subdir project's template as app and other subdir project as lib ?

          is there way to using qt creator though it's menu ?

          Pl45m4P 1 Reply Last reply
          0
          • Q Qt embedded developer

            @Pl45m4 In that can you tell me how to add first subdir project's template as app and other subdir project as lib ?

            is there way to using qt creator though it's menu ?

            Pl45m4P Offline
            Pl45m4P Offline
            Pl45m4
            wrote on last edited by Pl45m4
            #4

            @Qt-embedded-developer said in How to add two subdir project when empty qmake based project created ?:

            In that can you tell me how to add first subdir project's template as app and other subdir project as lib ?

            Doesn't matter in terms of subdir. But if you have a library you need to link against it in your other project. Also make sure, that the library is built first.
            Therefore the option .depends, as you can see in the linked doc page.
            The pro file of the library has to be configured using shared or dll for a dynamic and staticor staticlib for a static library.
            Like

            my_lib.pro

            CONFIG += shared
            

            @Pl45m4 said in How to add two subdir project when empty qmake based project created ?:

            Easy to find out when reading the documentation ;-)

            it says:

            If you need to ensure that the subdirectories are built in a particular order, use the .depends modifier on the relevant SUBDIRS elements.

            For example:

            SUBDIRS += my_executable my_library tests doc
            
            my_executable.depends = my_library
            
            tests.depends = my_executable
            

            Another link:

            • https://doc.qt.io/qtcreator/creator-how-to-add-subprojects-to-projects.html

            and another one ;-)

            • https://wiki.qt.io/SUBDIRS_-_handling_dependencies

            If debugging is the process of removing software bugs, then programming must be the process of putting them in.

            ~E. W. Dijkstra

            1 Reply Last reply
            3
            • Q Qt embedded developer has marked this topic as solved on

            • Login

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