[Qt-interest] How to distribute a Qt based library

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Mon Jan 10 11:23:54 CET 2011


On 2011-01-10 Sean Sean Harmer wrote:

> 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. ...
> 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

Also refer to http://doc.qt.nokia.com/latest/qmake-advanced-usage.html#adding-new-configuration-features


Another possibility (which in theory would also work with other build systems than qmake) is to provide a "pkg-config" *.pc configuration file. That works on Linux and Mac, and also on Windows, as long as you are using the MinGW based Qt environment (not sure whether a "native" pkgconfig port for Visual Studio compilers also exists).

So when your library provides such a pkg-config configuration file dependent project can then simply do a:

  CONFIG += link_pkgconfig
  PKGCONFIG += yourlibrary

in their *.pro project files. During development you can also set PKG_CONFIG_PATH as environment variable, such that these *.pc files are found.

Also refer to: 

* http://doc.qt.nokia.com/latest/qmake-project-files.html#configuration-features
* http://pkg-config.freedesktop.org/wiki/
* https://secure.wikimedia.org/wikipedia/en/wiki/Pkg-config


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





More information about the Qt-interest-old mailing list