Search code examples
c++qtqt4qmake

Add multiple files to output for extra compiler Qt


I am in trouble with adding multiple files to output for Qt extra compiler.
Here's how my extra compiler looks like:

 new_target.input = $${INPUT_HEADERS}
 new_target.output  = $${OUTPUT_FILES}
 new_target.commands = python $${SCRIPT_NAME}.py $${CONFIG_FILE} --generate
 new_target.CONFIG += target_predeps
 new_target.variable_out = SOURCES
 new_target.dependency_type = TYPE_C
 QMAKE_EXTRA_COMPILERS += new_target

Everything works fine until $${OUTPUT_FILES} does not contain multiple files.(for example: OUTPUT_FILES=first.cpp second.cpp third.cpp )
As a result qmake recognizes only first one mentioned.
Is it possible to pass multiple files to .output field?
I'm using Qt 4.8.6


Solution

  • As the docs say:

    output - The filename that is created from the custom compiler.

    Output should be one single file, not multiple. Depending on what you are trying to achieve, you may need to create a separate compiler target for each output file, or do in a loop using for(iterate, list):

    OUTPUT_TARGETS=first second third
    for(_TARGET, OUTPUT_TARGETS) {
        eval($${_TARGET}.input = INPUT_HEADERS)
        eval($${_TARGET}.output = $${_TARGET}.cpp)
        ...
    
        QMAKE_EXTRA_COMPILERS += $${_TARGET}
    }