Frage

There is somefile.h.in and script somefile.h.pl which generates number of files like "somefile.h.gen" or "somefile_other.cpp.gen2".

How to add source generation phase in qmake? In plain Makefile I'd just put things like

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
War es hilfreich?

Lösung

I need to use QMAKE_EXTRA_COMPILERS feature:

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
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top