kmdent
kmdent

Reputation: 1587

qt Qmake generating pkgconfig for a project

I have been told that it is possible to generate a pkg-config file through qmake, but I have no idea how to do it. I have been looking online for a while, and it seems as though it is something you just have to know how to do. Can someone give me an example, or point me to some sort of guide/tutorial?

Upvotes: 3

Views: 3394

Answers (2)

Engos
Engos

Reputation: 306

Is this what you are looking for?

To generate pkg-config using qmake you have to add to (modify) your project file (*.pro file):

unix {
    CONFIG += link_pkgconfig
    PKGCONFIG += <pc_file_without_extension>
}

Upvotes: 4

hans_meine
hans_meine

Reputation: 1921

If you want to generate a .pc file (in contrast to simply use pkg-config to find dependencies, which is well supported by qmake), you might be interested in the following. Obviously, creating .pc files is a less visible, but existing feature of QMake. You want to use CONFIG += create_pc, which depends on create_prl. If you don't want to install the .prl file, use no_install_prl, too. Overall, this gives you:

CONFIG += create_pc create_prl no_install_prl

QMAKE_PKGCONFIG_NAME = VigraQt
QMAKE_PKGCONFIG_DESCRIPTION = Qt4 bindings for the VIGRA library
QMAKE_PKGCONFIG_PREFIX = $$INSTALLBASE
QMAKE_PKGCONFIG_LIBDIR = $$target.path
QMAKE_PKGCONFIG_INCDIR = $$headers.path
QMAKE_PKGCONFIG_VERSION = $$VERSION

This is what I came up with for VigraQt. There's also QMAKE_PKGCONFIG_DESTDIR, which you may use to specify the location of the .pc files within the source directory. Finally, there are QMAKE_PKGCONFIG_VARIABLES, QMAKE_PKGCONFIG_REQUIRES, and QMAKE_PKGCONFIG_CFLAGS in addition to the above.

(There is also create_libtool for .la files, which also depends on the .prl files.)

Upvotes: 6

Related Questions