2011-09-21 67 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 
相关问题