有somefile.h.in和script somefile.h.pl可以生成像"somefile.h.gen“或"somefile_other.cpp.gen2”这样的文件。
如何在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发布于 2011-09-22 05:46:17
我需要使用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.genhttps://stackoverflow.com/questions/7502127
复制相似问题