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. Dependencies in Qt project
Qt 6.11 is out! See what's new in the release blog

Dependencies in Qt project

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 2 Posters 4.2k 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.
  • O Offline
    O Offline
    ornello
    wrote on last edited by
    #1

    I have a problem building my subdired project with Qt creator 3.6.0.

    My Qt project is structured as suggested here:
    http://dragly.org/2014/03/13/new-project-structure-for-projects-in-qt-creator-with-unit-tests

    This results in three subdirectories with corresponding pro files:

    • src (creates a static lib for the project)
    • app (creates the application including static lib)
    • tests (creates tests including static lib)

    The main pro file looks as follows:

    TEMPLATE = subdirs
    CONFIG+=ordered
    SUBDIRS = \
        src \
        app \
        tests
    
    app.depends = src
    tests.depends = src
    
    OTHER_FILES += \
        defaults.pri
    

    default.pri:

    INCLUDEPATH += $$PWD/src
    SRC_DIR = $$PWD
    

    When I change the source code and type F5 to build and run the project, the app folder is not rebuilt (although I have set app.depends = src). The change is not applied and the application remains unchanged.

    What I have to do to correctly build the application is the following:

    1. Run "Build src" on src folder
    2. Run "Rebuild" on app folder
    3. Start application with F5.

    How can I define my pro files in order to build & run my application simply by typing F5?

    Thanks for suggestions...

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

      Hi and welcome to devnet,

      You should remove CONFIG += ordered since your are setting the dependency.

      See this article for more information.

      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
      1
      • O Offline
        O Offline
        ornello
        wrote on last edited by
        #3

        Hello SGaist,

        thanks a lot for your suggestion. However it did not solve the problem.

        I have made some more attempts with the following sample project:
        https://github.com/ComputationalPhysics/qtcreator-project-structure

        Seems that F5 build is working for MinGW but not for MSVC2013 projects (which I am using). When I configure the sample project with MinGW code changes are automatically rebuilt (as expected). When I configure the sample project with MSVC2013 automatic rebuild is not working, so I first have to build the source and then rebuild the app folder (as described in my previous post).

        Any ideas why the behavior is different and how I can change the project config to work with MSVC as well?

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

          Silly question but after removing the CONFIG line, did you do a full rebuild ?

          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
          • O Offline
            O Offline
            ornello
            wrote on last edited by
            #5

            Yes, full rebuild is indeed working, but my hope was that the project dependencies are sufficient for Qt Creator to know what needs to be rebuilt when typing F5.

            Also, I do not understand why it is working for MinGW but not for MSVC2013.

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

              When changing a CONFIG option, a full rebuild is generally a good step. However, are you still experimenting the issue after that ?

              Visual Studio has it's own project handling. MinGW is just a set of tools, the projects using it generally have Makefiles to handle the building part.

              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
              • O Offline
                O Offline
                ornello
                wrote on last edited by ornello
                #7

                I think my answer was not clear enough: For the MSVC configuration, I have to do a full rebuild every time something has changed in the sources, not just after changing the CONFIG option. This takes much more time for building than just "refreshing" the application with F5.

                But maybe it is better to give a closer look at the Makefiles (as you suggest) in order to see what really happens.

                1 Reply Last reply
                0
                • O Offline
                  O Offline
                  ornello
                  wrote on last edited by
                  #8

                  In the end what helped was adding a direct dependency to the lib in app.pro/tests.pro, e.g.

                  PRE_TARGETDEPS += $$OUT_PWD/../src/debug/<libname>.lib

                  1 Reply Last reply
                  1

                  • Login

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