Question


Issue

I am working on a multi-executable QT project using qmake in conjunction with QT Creator. Each executable has its' own .pro file, all of which are included in an over-arching .pro file (template=subdirs). Each individual .pro file also includes a common .pri file which sets DESTDIR so that all the executables end up in the same place. This DESTDIR is dependent on whether it is being compiled as debug or release. This has worked wonderfully until we added a collection of executables via another subdir .pro beneath the over-arching one. The overall setup looks something like this:

  • All.pro
  • | - Project1.pro
  • | - Project2.pro
  • | - Subdirs.pro
  • | -- | - Project3.pro
  • | -- | - Project4.pro

If you have a freshly checked out copy, you can run qmake and all will work, until you switch from debug to release, or vice-versa. When you do, Project1.pro and Project2.pro update just fine and put their executables in the right directory, but Project3.pro and Project4.pro use the old directory.


Attempts

If I manually remove all the affected makefiles, qmake will generate new ones. I suppose I could write some sort of a pre-compile command to remove all makefiles every time, but that seems like the wrong way to do things, let alone the amount of time I would have to spend making sure it worked on all our platforms.

I have tried this in QT 4.6.4 through 4.8.1

When I use QT Creator, I switch between Debug and Release modes via differing build configurations which mimics what I do on the command lie (ie adding or removing CONFIG+=debug)


Questions

  • What is preventing qmake from updating the makefiles?
  • If it is just a bug in qmake, what is the best workaround?

Any and all help is greatly appreciated.

Was it helpful?

Solution

Even though the QMake documentation indicates it is only for Project Mode (creating .pro files), try adding the -r option to qmake to force it to recurse through the directories.

This is what we have used on our many level deep SUBDIR projects in the past.

OTHER TIPS

We had the same issue and worked around it by running "make qmake" from top level directory after switching between debug/release.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top