PDA

View Full Version : Auto-detect dependencies for make



magland
15th November 2007, 10:00
When qmake generates a make file, I think that it must specify which files depend on others, so that the compiler knows which source files need to be recompiled.

For example, suppose I have



HEADERS = foo.h bar.h
SOURCES = foo.cpp


and in foo.cpp, I have



#include "foo.h"
#include "bar.h"
...


If bar.h is modified, then foo.cpp is recompiled upon make.

Here's my question. What if I don't want bar.h to appear in the HEADERS variable? Then foo.cpp will not be recompiled when bar.h is modified :(. Is there a way for me to tell qmake to please look at bar.h --- but don't run moc on it?

magland
15th November 2007, 10:48
I think I have solved my own problem.

I was mistaken in my previous post.... this has nothing to do with which files appear in the HEADERS variable. It has a lot to do with the DEPENDPATH variable.

But it's not so straightforward. If somebody could write a detailed explanation of the rules for which files get recompiled when, that would be very useful.

The reason that this is important, is that if a header file changes and a library or plugin does not get recompiled, it can lead to an unexpected program crash.