summaryrefslogtreecommitdiff
path: root/xmake/modules/package/tools
diff options
context:
space:
mode:
authorruki <[email protected]>2025-03-15 08:12:02 +0800
committerGitHub <[email protected]>2025-03-15 08:12:02 +0800
commitcc9a01476ac7ea24dc2971dbaeeccd8affb2f85d (patch)
treef7d5cb0f5f2a3376b5183d4b01a80f2e5c33ba9c /xmake/modules/package/tools
parent817d9ad4736ac60f3a5b55609b0be64a15175dfb (diff)
parent23cb6427ccff1e675300c77aa07db1d22b270606 (diff)
Merge pull request #6222 from SirLynix/patch-19
meson: Add cmake search env
Diffstat (limited to 'xmake/modules/package/tools')
-rw-r--r--xmake/modules/package/tools/meson.lua21
1 files changed, 19 insertions, 2 deletions
diff --git a/xmake/modules/package/tools/meson.lua b/xmake/modules/package/tools/meson.lua
index 8a34682a4..7f3260682 100644
--- a/xmake/modules/package/tools/meson.lua
+++ b/xmake/modules/package/tools/meson.lua
@@ -495,6 +495,9 @@ function buildenvs(package, opt)
end
local ACLOCAL_PATH = {}
local PKG_CONFIG_PATH = {}
+ local CMAKE_LIBRARY_PATH = {}
+ local CMAKE_INCLUDE_PATH = {}
+ local CMAKE_PREFIX_PATH = {}
for _, dep in ipairs(package:librarydeps({private = true})) do
local pkgconfig = path.join(dep:installdir(), "lib", "pkgconfig")
if os.isdir(pkgconfig) then
@@ -504,6 +507,17 @@ function buildenvs(package, opt)
if os.isdir(pkgconfig) then
table.insert(PKG_CONFIG_PATH, pkgconfig)
end
+ -- meson may also use cmake to find dependencies
+ if dep:is_system() then
+ local fetchinfo = dep:fetch()
+ if fetchinfo then
+ table.join2(CMAKE_LIBRARY_PATH, fetchinfo.linkdirs)
+ table.join2(CMAKE_INCLUDE_PATH, fetchinfo.includedirs)
+ table.join2(CMAKE_INCLUDE_PATH, fetchinfo.sysincludedirs)
+ end
+ else
+ table.join2(CMAKE_PREFIX_PATH, dep:installdir())
+ end
end
-- some binary packages contain it too. e.g. libtool
for _, dep in ipairs(package:orderdeps()) do
@@ -512,8 +526,11 @@ function buildenvs(package, opt)
table.insert(ACLOCAL_PATH, aclocal)
end
end
- envs.ACLOCAL_PATH = path.joinenv(ACLOCAL_PATH)
- envs.PKG_CONFIG_PATH = path.joinenv(PKG_CONFIG_PATH)
+ envs.ACLOCAL_PATH = path.joinenv(ACLOCAL_PATH)
+ 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