Skip to content
  • QMAKE_EXTRA_COMPILERS and MOC

    Unsolved Qt Creator and other tools qmakeextracom make
    2
    0 Votes
    2 Posts
    2k Views
    E
    I had the same problem, solved it by making a new compiler that uses the generated header file as input and runs moc on it to generate the missing source file. From my .pro: dbc2cpp_canbus_h.name = Generating canbus.h from DBC file. dbc2cpp_canbus_h.CONFIG += combine dbc2cpp_canbus_h.input = "DBC_A_C" dbc2cpp_canbus_h.output = canbus.h dbc2cpp_canbus_h.commands = bash -c 'dbc2cpp --target CANBUS_H CLUSTER <($${DBC_A_GIT}) <($${DBC_C_GIT})' dbc2cpp_canbus_h.variable_out = HEADERS QMAKE_EXTRA_COMPILERS += dbc2cpp_canbus_h CANBUS_H = canbus.h new_moc.commands = moc $(DEFINES) $(INCPATH) canbus.h -o ${QMAKE_FILE_OUT} new_moc.input = "CANBUS_H" new_moc.output = moc_canbus.cpp new_moc.variable_out = SOURCES QMAKE_EXTRA_COMPILERS += new_moc