Important: Please read the Qt Code of Conduct -

Inconsistent builds with Subdirs Project and switching devices

  • I have a project that is to be compiled as a Desktop or a Ios application. My subdirs project contains this:


    TEMPLATE = subdirs

    CONFIG += ordered

    SUBDIRS = ../Underworld ../EngineOGL ../Ankh@

    When I switch between devices and hit "rebuild", I am seeing the build files "get stuck" on the previous device. For example, if I compile as Ios for a while, everything seems to be fine. But when I switch to Desktop, I sometimes catch the compiler not building the desktop libraries, but continuing to build the Ios version. After several rebuilds, cleans and waving a dead chicken over my computer, my application will eventually build the right version.

    Does anyone have any idea why simply rebuilding isn't working consistently?

  • Moderators

    Clean project

    Run qmake


    That should work reliably. The problem (most probably) is in outdated Makefiles, and to update them you need to run qmake.

  • Lifetime Qt Champion


    Just a wild guess, does it also happen if you remove the cache() line ?

    There's also something a bit surprising in your setup, subdirs project generally have their subdirs in the same folder as the pro file which defines the subdirs template.

  • Sierdzio,
    It appears your solution works so far. Makes sense what was going on now.
    Thanks for your help!

  • Moderators

    Another way might be to use shadow building option from Qt Creator (that may save a lot of time during project building), but I'm not sure as I don't use it.

    The general idea behind shadow builds is that all Kit setups get a separate build directory, and so when switching between Kits you do not need to recompile everything.

  • Lifetime Qt Champion

    sierdzio has a good point about shadow building, especially when you're cross-compiling (or using several different versions of Qt)

Log in to reply