I have built opencv locally and installed it to a local directory (not the system default ). opencv.pc
is present under a folder pkgconfig in this local folder. How
You could set PKG_CONFIG_PATH
with the CMake line:
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/my/path/to/pkgconfig")
I did this workaround in this file
Interestingly, it seems CMake 3.1 extends PKG_CONFIG_PATH
with some CMake variable see: https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3df51470