如何将库的.pc文件添加到特定目录? [英] How to add a library's .pc file to a specific directory?
问题描述
如何将新安装的库的.pc
文件添加到pkg-config
的路径.以我的经验,这是自动发生的,但不是最近通过homebrew
安装的opencv3
.
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
.
我的大多数图书馆的.pc
文件位于/usr/local/lib/pkgconfig
(包括opencv
)中,但不在opencv3
Most of my libraries' .pc
files are in /usr/local/lib/pkgconfig
(including opencv
), but not opencv3
库opencv3
在/usr/local/cellar
中存在,并且在/usr/local/cellar/opencv3/3.1.0_4/lib/pkgconfig
中确实具有opencv.pc
.
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
.
现在我需要pkg-config
来找到它,但我认为将.pc
添加到现有路径而不是添加一条新路径更有意义.
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.
推荐答案
我注意到了同样的情况.您只需指定.pc
文件的完整路径即可,而不使用PKG_CONFIG_PATH
.
I have noted the same. You can just specify a full path to a .pc
file instead of using a PKG_CONFIG_PATH
.
因此,我倾向于在bash
中使用它,并在Makefile
中将美元加倍,因为它避免了升级时必须进行任何更改:
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")
我的方法假设我没有保留多个版本的hombrew
软件包版本-无论如何我还是不这样做-YMMV!
My method assumes that I don't keep multiple versions of hombrew
package version lying around - which I do not anyway - YMMV!
这篇关于如何将库的.pc文件添加到特定目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!