[Qt-interest] Makefile rules in .pro file?
Phil Dumont
phil at solidstatescientific.com
Fri Aug 5 20:46:43 CEST 2011
It's a bit kludgey, but adding this line:
!exists(myapp_gen.h): system(touch --reference myapp.ini myapp_gen.h; touch
myapp.ini)
anywhere before I add myapp_gen.h to the HEADERS variable stops qmake from
complaining and still makes the source generation script run on the first
make.
phil
On Fri, Aug 5, 2011 at 1:16 PM, Phil Dumont
<phil at solidstatescientific.com>wrote:
> I've got it working *almost* perfectly.
>
> My .pro file looks something like this:
>
> QT -= gui
> TARGET = myapp
> CONFIG += console
> CONFIG -= app_bundle
> TEMPLATE = app
>
> SOURCES += myapp.cpp
>
> HEADERS += myapp.h \
> myapp_gen.h
>
> gensrc.target = myapp_gen.h
> gensrc.depends = gen_header.py myapp.ini
> gensrc.commands = gen_header.py
>
> QMAKE_EXTRA_TARGETS += gensrc
> PRE_TARGETDEPS += myapp_gen.h
>
>
> The only thing keeping me from being completely happy is, when I run qmake,
> it complains thusly:
>
> WARNING: Failure to find: myapp_gen.h
>
>
> Ordinarily, qmake complaining about a missing header would be good. But
> under current circumstances, not so much. Is there any way to turn it off?
> Alternatively, I could throw a message() in the .pro file that tells the
> next person to build the project (maybe even me, after I've had long enough
> to forget) that the ominous looking message is nothing to worry about. But
> that wouldn't be quite a clean.
>
> Anyway, despite the warning, the Makefile is generated, and does the right
> thing.
>
> phil
>
>
> On Fri, Aug 5, 2011 at 12:31 PM, Phil Dumont <
> phil at solidstatescientific.com> wrote:
>
>> After hitting send, I looked just a little more... Looks like
>>
>> http://doc.trolltech.com/4.7/qmake-environment-reference.html#customizing
>>
>> might be what I'm looking for.
>>
>> phil
>>
>>
>> On Fri, Aug 5, 2011 at 12:02 PM, Phil Dumont <
>> phil at solidstatescientific.com> wrote:
>>
>>> Hi all,
>>>
>>> I'm starting on a Qt project where one of the source files (a header) is
>>> going to be generated by a script. I would like a rule in my Makefile that
>>> runs the script when the target is missing or older than it's dependencies.
>>> I've looked quite a lot through qmake documentation, but have been unable
>>> to find what to put in my .pro file to get this done. Any help?
>>>
>>> Thanks,
>>> phil
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110805/abf2811c/attachment.html
More information about the Qt-interest-old
mailing list