[Interest] generated header file not being processed by moc
Glen Mabey
gmabey at swri.org
Mon Feb 13 19:04:56 CET 2017
Hello,
I think I’ve got the exact problem described here back in 2012: https://forum.qt.io/topic/21964/qmake-custom-compilers-how-to-process-generated-header-files-with-moc
That is, my generated header file includes a class that inherits from QObject and needs to be moc'ed.
However, these lines are not sufficient to make that happen the first time the project is built:
OBJ_SOURCE = dummy_input_file.txt
OBJ_GENERATOR.CONFIG += no_link target_predeps
OBJ_GENERATOR.output = ${QMAKE_FILE_BASE}_QObject.h
OBJ_GENERATOR.commands = ./generate_a_file.py ${QMAKE_FILE_OUT}
OBJ_GENERATOR.input = OBJ_SOURCE
OBJ_GENERATOR.variable_out = HEADERS
QMAKE_EXTRA_COMPILERS += OBJ_GENERATOR
That is, the project fails to link due to undefined references.
If I rerun qmake and build again, though, everything works out fine.
Any suggestions?
Glen
More information about the Interest
mailing list