[Qt-interest] add external makefile to qmake project

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Thu Mar 5 14:44:57 CET 2009


Andrea Franceschini wrote on Wednesday, February 25, 2009 12:29 PM:

> 2009/2/25 Jens Luedicke <jens.luedicke at gmail.com>:
> 
>> I have an third-party module (static library) that comes with its own
>> Makefile and I want to integrate it into a qmake project.
> ...
> I did was, in the first place, add the sources of the static library
> to my project file and make them compile statically inside my
> application, but this was not a solution. Then I modified the
> original makefile to build a shared object and informed the original
> developer of this.

I think the OP was more interested in the answer of the question: "How can you call an external Makefile, given a qmake-based project?"

At least in Qt 3 there was the qmake concept of "custom targets" (at least on Unix/Linux), and together with "qmake dependencies" I think it would be possible to call an external Makefile (basically you can call any shell command from within the custom target).

But again, that was Qt 3: http://doc.trolltech.com/3.3/qmake-manual-8.html#Customizing

(Not sure how to set dependencies on custom targets though - but given a custom target, you can make it depend on another custom target).

In Qt 4 qmake I think this concept has gone, so no more 'make my_custom_target' anymore.

But since it seems you are working on Unix/Linux you could make a GNUMakefile "wrapper", which first calls "make" upon your external library, and then invokes "qmake; make" (as to build the actual Qt application).

Note that with GNU make a "GNUmakefile" (or GNUMakefile?) has always precedence over a simple Makefile in the same directory, so when you call 'gmake' the GNUMakefile - the "wrapper" - is taken :)

Cheers, Oliver
-- 
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22



More information about the Qt-interest-old mailing list