Reputation: 363
How can I make pkg-config find both dependencies installed via Conan AND dependencies that are not in Conan?
My target package is built using CMake and finds its dependencies using pkg-config with pkg_check_modules()
. One of the dependencies (glib-2.0
) is installed via Conan, another (libsecret-1
) isn't, as there's no package.
In my conanfile I'm configuring the pkg-config_installer as a build requirement (self.build_requires("pkg-config_installer/0.29.2@bincrafters/stable")
. When building the package, CMake correctly invokes this pkg-config.
As a result, pkg-config finds glib just fine, but it cannot find libsecret. I assume it finds .pc
files for dependencies installed via Conan, but doesn't find libsecret-1.pc
, which is located in /usr/lib/pkgconfig/
on my system.
I tried telling Conan's CMake tool to use this path: tools.PkgConfig("libsecret-1").variables["pcfiledir"]
tells me where it is and the CMake tool's configure method has a pkg_config_paths
parameter. Unfortunately, this changes nothing.
Upvotes: 0
Views: 1653
Reputation: 363
The following steps made it work for me:
PKG_CONFIG_PATH
environment variable to the pcfiledir
found by tools.PkgConfig
pkg_config_paths
to tools.CMake.configure()
, it doesn't handle absolute paths well and conflicts with the environment variablesecret-1
in my case) to cpp_info.system_libs
in the package_info
stepThanks @uilianries for the helpful comment!
Upvotes: 0