diff options
Diffstat (limited to 'xmake/modules/package/tools/meson.lua')
| -rw-r--r-- | xmake/modules/package/tools/meson.lua | 21 |
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 |
