2011-09-21 36 views
0

somefile.h.in和腳本somefile.h.pl它生成像「somefile.h.gen」或「somefile_other.cpp.gen2」文件的數量。如何將可生成的源文件添加到qmake項目中更好?

如何在qmake中添加源代碼階段?在普通的Makefile我只是把東西像

somefile.o: somefile.cpp somefile.h somefile.h.gen 
     ... 

soemfile.h.gen: somefile.h.in somefile.h.pl 
     ./somefile.h.pl < somefile.h.in # writes somefile.h.gen and friends 

回答

0

我需要使用QMAKE_EXTRA_COMPILERS功能:

PREPROCESS_FILES = somefile.h.in 
preprocess.name = Generate various files based on somefile.h.in 
preprocess.input = PREPROCESS_FILES 
preprocess.output = ${QMAKE_FILE_BASE}.gen 
preprocess.commands = perl $$PWD/somefile.h.pl $$PWD/somefile.h.in 
preprocess.CONFIG += no_link 
QMAKE_EXTRA_COMPILERS += preprocess 

PRE_TARGETDEPS += somefile.h.gen 
相關問題