I am using Qt5 with VS2012. My .vcxproj files are generated from .pro files using qmake. My current task is to generate a header file (that contains simple version information) every time the application is built using Visual Studio. I could add a custom pre-build step to my VS project but that would get lost every time the .vcxproj is regnerated from .pro. So I need a .pro file based solution.
I was told QMAKE_EXTRA_COMPILERS is what I need. So I tried to add a new compiler to one of my .pro files. Something like this:
PHONY_DEPS = .
headergen.input = PHONY_DEPS
headergen.output = test.c
headergen.variable_out = GENERATED_SOURCES
headergen.commands = echo Test > test.c
headergen.name = CREATE test.c
headergen.CONFIG += combine
QMAKE_EXTRA_COMPILERS += headergen
This actually creates a test.c file every time I build my application. However I do not want to generate a .c file but a .h header:
PHONY_DEPS = .
headergen.input = PHONY_DEPS
headergen.output = test.h
headergen.variable_out = HEADERS
headergen.commands = echo Test > test.h
headergen.name = CREATE test.h
headergen.CONFIG += combine
QMAKE_EXTRA_COMPILERS += headergen
This one fails without any error printed by qmake. The .vcxproj simply does not contain any additional build step.
I never used QMAKE_EXTRA_COMPILERS before and the documentation is pretty poor. Could someone please give me a hint how to create a header generation rule?
↧