问题
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