QMAKE_EXTRA_COMPILERS and MOC



  • I have a problem using QMAKE_EXTRA_COMPILERS to generate source files for QObject derived classes.
    It seems like MOC compiler doesn't sees these generated files and project linking fails because of absent MOC generated functions for my classes.
    I have to re-run qmake to enforce MOC to generate *_moc.cpp files for my generated classes.

    Here is a little example of my source files generator.

    my_src_gen.name = My Source generator ${QMAKE_FILE_IN}
    my_src_gen.input = MY_SOURCES
    my_src_gen.output = ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.my.cpp
    my_src_gen.commands = $$PWD/my_gen.bat ${QMAKE_FILE_IN} ${QMAKE_FILE_PATH}
    my_src_gen.CONFIG += target_predeps
    my_src_gen.variable_out = SOURCES
    silent:my_src_gen.commands = @echo my_src_gen ${QMAKE_FILE_IN} && $$my_src_gen.commands
    QMAKE_EXTRA_COMPILERS += my_src_gen
    

    There is a test example project QMAKE_EXTRA_COMPILERS_test (windows) where the problem is reproduced.

    How to avoid second qmake invocation there?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.