qt qmake extra compilers with dependencies among generated files
Can qmake handle dependencies of generated source files?
We have a prf file like this:
idl_h.name = Generate .H file for ${QMAKE_FILE_BASE}.idl
idl_h.input = IDLS # variable containing our input files
idl_h.variable_out = HEADERS
idl_h.commands = <command that takes .idl and genrates .h>
idl_h.output = $$IDL_GEN_DIR/${QMAKE_FILE_BASE}.h
QMAKE_EXTRA_COMPILERS += idl_h
This generation works fine and creates .h files at make time. The problem is that the input files ($$IDLS
) depend on each other, and are not always built in the correct order. We have something like app.idl
, containing:
#include "common.idl"
It seems the following should work
idl_h.depend_command = g++ -EE ... $$IDL_GEN_DIR/${QMAKE_FILE_BASE}.h
but apparently the depend_command is not actually executed.
Another idea开发者_JS百科 would be to parse the dependencies out of the original idl:
idl_h.depends = $$system(cat ${QMAKE_FILE_IN} | grep "^#include" | sed -re 's/#include\s+["<]([^.]+)\.idl[">]/\1.h/')
but it seems my qmake syntax is failing me.
Try adding
idl_h.dependency_type = TYPE_C
to your prf, and drop the .depend_command and .depends
精彩评论