问题
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:
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
来源:https://stackoverflow.com/questions/30934230/qmake-analog-of-cmakes-find-package