[Qt-interest] How to distribute a Qt based library
Sean Harmer
sean.harmer at maps-technology.com
Mon Jan 10 10:21:48 CET 2011
Hi,
On Monday 10 January 2011 09:03:00 Merwin wrote:
> Hi,
>
> I wrote a simple Qt based logging library for Qt application. I would
> like to distribute it. The goal is to make it easily integrable into Qt
> projects. For example, providing a .pri file, and sources.
>
> Then you would just have to download the library, include the .pri file,
> and run qmake && make (or event tweak a little your .pro file).
>
> Is it possible? Is there a better way? How can I do this ?
What we do is to install a .prf file as part of the "make install" phase of
our library's build process. If you install a mycoollibrary.prf file into a
location that qmake knows about then the users of your library can simply add:
CONFIG += mycoollibrary
to have the contents of your .prf file sourced. The .prf file just contains
the usual qmake directives to allow the client app/lib to find your library's
headers and dll/so files for linking.
The system locations for the .prf files usually require root access (on
Linux). However you can install your own prf files anywhere you like and then
tell qmake about them by setting the environment variable QMAKEFEATURES.
For example when developing locally we install our library prf files into
$HOME/local/features. Then when building apps that use these libraries we do:
export QMAKEFEATURES=$HOME/local/features
followed by the usual qmake, make, make install.
HTH,
Sean
More information about the Qt-interest-old
mailing list