I have changed the project file to make sure SOURCES always contains the generated files:

test.pro:
Qt Code:
  1. SOURCES = main.cpp
  2. TRANSLATIONS=test_de.ts
  3.  
  4. GEN_SOURCES = generated.cpp
  5. include( gen.pri )
To copy to clipboard, switch view to plain text mode 

gen.pri:
Qt Code:
  1. SOURCES += $$GEN_SOURCES
  2. for( src, GEN_SOURCES ): GEN_INPUT += $$replace( src, .cpp, .gen )
  3.  
  4. gen.input = GEN_INPUT
  5. gen.output = ${QMAKE_FILE_BASE}.cpp
  6. gen.commands = cp ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT}
  7. gen.variable_out =
  8. QMAKE_EXTRA_COMPILERS += gen
To copy to clipboard, switch view to plain text mode 

Now when I invoke "lupdate test.pro" after the project was built, it works fine.

The remaining problem is that it will fail silently if the project was not built and "generated.cpp" does not exist (not even a warning)!
This is a problem to me since I might accidentally damage my translation files without even noticing if I forget to build the project before calling lupdate...