QMake analog of cmake's “find_package”

只愿长相守 提交于 2021-01-02 06:41:27

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!