如何将库的.pc文件添加到特定目录? [英] How to add a library's .pc file to a specific directory?

查看:180
本文介绍了如何将库的.pc文件添加到特定目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将新安装的库的.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆