Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QMake analog of cmake's "find_package"

Tags:

c++

qmake

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?

like image 400
DAlexies Avatar asked Jun 19 '15 09:06

DAlexies


1 Answers

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
like image 160
zgyarmati Avatar answered Oct 29 '22 15:10

zgyarmati