QMake analog of cmake's "find_package"

2.6k views Asked by At

Is there are any mechanism in qmake like cmake's find_package?

If I need to include library installed on my system, how can I avoid to write include path and library names manually? What is the best practice?

1

There are 1 answers

0
zgyarmati On

If the used library provides pkgconfig .pc file, you can use link_pkgconfig in your .pro file as:

CONFIG += link_pkgconfig
PKGCONFIG += quazip

If the library provides a command line utility to get the compiler flags (like postgresql does), then you can call it and assign add output to the corresponding variabla

INCLUDEPATH += $$system(pg_config --includedir)

If the library itself was written in Qt as well, unlikely, but possible that it provides a Qt module, like qwt does for instance. In this case you can just add to your .pro file:

CONFIG += qwt