How to add a library's .pc file to a specific directory?

半腔热情 提交于 2019-12-25 04:49:25

问题


How can I add a newly installed library's .pc file to pkg-config's path. In my experience this happens automatically, but not with recently installed opencv3 via homebrew.

Most of my libraries' .pc files are in /usr/local/lib/pkgconfig (including opencv), but not opencv3

The library opencv3 exists in /usr/local/cellar, and does have a opencv.pc in /usr/local/cellar/opencv3/3.1.0_4/lib/pkgconfig.

Now I need pkg-config to find it, but I think it makes more sense to add this .pc to an existing path rather than add a whole new path.

Is there a recommended process to add it? Thank you very kindly.


回答1:


I have noted the same. You can just specify a full path to a .pc file instead of using a PKG_CONFIG_PATH.

So, I tend to use this in bash and double up the dollars in Makefile since it avoids having to change anything when I upgrade:

pkg-config ... $(find /usr/local/cellar/opencv3 -name "opencv*.pc") 

My method assumes that I don't keep multiple versions of hombrew package version lying around - which I do not anyway - YMMV!



来源:https://stackoverflow.com/questions/40434689/how-to-add-a-librarys-pc-file-to-a-specific-directory

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