From 40e70336ebbb4a6deb7c8277b7371d712cc2d621 Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 4 Sep 2023 23:29:38 +0800 Subject: add pkg config path for cmake --- xmake/modules/package/tools/cmake.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 6fd8ce855..2174508e2 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -742,6 +742,7 @@ function buildenvs(package, opt) local CMAKE_LIBRARY_PATH = {} local CMAKE_INCLUDE_PATH = {} local CMAKE_PREFIX_PATH = {} + local PKG_CONFIG_PATH = {} for _, dep in ipairs(package:librarydeps()) do if dep:is_system() then local fetchinfo = dep:fetch() @@ -752,11 +753,20 @@ function buildenvs(package, opt) end else table.join2(CMAKE_PREFIX_PATH, dep:installdir()) + local pkgconfig = path.join(dep:installdir(), "lib", "pkgconfig") + if os.isdir(pkgconfig) then + table.insert(PKG_CONFIG_PATH, pkgconfig) + end + pkgconfig = path.join(dep:installdir(), "share", "pkgconfig") + if os.isdir(pkgconfig) then + table.insert(PKG_CONFIG_PATH, pkgconfig) + end end end envs.CMAKE_LIBRARY_PATH = path.joinenv(CMAKE_LIBRARY_PATH) envs.CMAKE_INCLUDE_PATH = path.joinenv(CMAKE_INCLUDE_PATH) envs.CMAKE_PREFIX_PATH = path.joinenv(CMAKE_PREFIX_PATH) + envs.PKG_CONFIG_PATH = path.joinenv(PKG_CONFIG_PATH) return envs end -- cgit v1.3.1