Qt's moc.exe generates files moc_predefs.h
, that contain some defines, that are included to every file that moc parses. Is there a way to add defines to these files?
I'd like to define some include guards in these files to prevent moc.exe from parsing some headers (mostly 3rd party headers like boost). I could define these guards directly as moc's parameter using QMAKE_MOC += -Dfoo
, but that would unnecessarily bloat the makefiles, it would be much nicer to have it directly in the moc_predefs.h
file.
I've noticed that flags defined in the pro file e.g. QMAKE_CXXFLAGS += -Dfoo
produce defines in moc_predefs.h
. But obviously I don't want to define include guards for the build, just for moc...
Note I don't want to modify the generated files directly, I'm looking for a way to tell qmake / moc to add some extra defines to the files.