Important: Please read the Qt Code of Conduct -

Compiling a subproject from a larger superproject

  • Hi,

    I have a large project that has many (nested) "subdir" projects. One of these "subdir" projects is a library and the others are applications that require the library.

    If I make a change in the library and want to compile ONLY one application for testing, I have to recompile the whole project (all applications).

    What I would actually like is that if I compile only ONE application - and have made a change in the library - qmake detects the change in the dependency and compiles the library first and then the application (instead of compiling everything; the other applications should not be touched).

    Is this possible to do with qmake?



  • If you run make in command line in the build directory then it will rebuild only changed files and dependent applications.
    In qtcreator build on the top level project should do the same.
    You don't need to run qmake if change the sources and did not change the project structure.

  • That's what I am doing. But this results in re-linking all applications which is annoying since it takes some time...

    What I kind of want is a project dependency, i.e. that the library project is built before the applcation.



  • Yep, you are right. If other apps depend on that library then make will relink all of them.
    I had an impression the calling "make some/path/myapp" will rebuild library and my app only. But it does not work this way.
    My bad. Need to test my suggestion before posting them.

  • have you try
    @CONFIG += ordered@
    doc says: "When using the subdirs template, this option specifies that the directories listed should be processed in the order in which they are given."

Log in to reply