Building a subdirs project

  • I have a project which is organzed as follows

    TEMPLATE = subdirs
    app.depends = lib

    TARGET = MyLib
    TEMPLATE = lib
    CONFIG += staticlib
    CONFIG += create_prl # Following

    TARGET = MyApp
    TEMPLATE = app
    CONFIG += link_prl # Following


    If I make a change in the lib source, then I find that if I build the project (by pressing the hammer in QtCreator), then the changes do not actually show up in the program that runs. If I try to build by just pressing Run or Start Debugging, I get the same effect. MyApp is the only build target I can choose from the Computer icon in QtCreator. As a result I actually have to Rebuild (by right clicking on root node in the Project explorer tree), which takes ages every time, however small the change I make.

    How can I get QtCreator to only build the small parts of my project where a change occurs?

  • Lifetime Qt Champion


    IIRC, you need to use PRE_TARGETDEPS in your to tell the system to watch for changes in your static library

  • @SGaist said:


    That seems to have done it, thanks!!!

  • I recently resolved a boatload of issues like this in my project, and I found that if you use the wizard to add an internal library, pointing to your dependent library, all of the necessary bookkeeping is done for you. I then took the resulting auto-generated code and created a .pri file. Then instead of using the wizard all the time, I just include the .pri file and all of the paths etc. are taken care of.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.