diff options
| author | Ângelo Andrade Cirino <[email protected]> | 2022-01-10 10:23:17 -0300 |
|---|---|---|
| committer | Ângelo Andrade Cirino <[email protected]> | 2022-01-10 10:23:17 -0300 |
| commit | ed0c0c5e0249aa966ea7061b30710abdd0b09d87 (patch) | |
| tree | 2a51c869a3aea1a093ed569e749bdf0465634a6c /xmake/modules/lib/detect/pkgconfig.lua | |
| parent | 885d00da8caf74aeed758d030b9a1b50d9078e1f (diff) | |
| parent | 2431dd7e6142ff98b55741cfd4de4d2e69f4f8b5 (diff) | |
Merged from upstream/master
Diffstat (limited to 'xmake/modules/lib/detect/pkgconfig.lua')
| -rw-r--r-- | xmake/modules/lib/detect/pkgconfig.lua | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/xmake/modules/lib/detect/pkgconfig.lua b/xmake/modules/lib/detect/pkgconfig.lua index 9cd07a1e7..cf6b6d97d 100644 --- a/xmake/modules/lib/detect/pkgconfig.lua +++ b/xmake/modules/lib/detect/pkgconfig.lua @@ -24,7 +24,15 @@ import("core.project.target") import("core.project.config") import("lib.detect.find_file") import("lib.detect.find_library") -import("detect.tools.find_pkg_config") +import("lib.detect.find_tool") + +-- get pkgconfig +function _get_pkgconfig() + local pkgconfig = find_tool("pkg-config") or find_tool("pkgconf") + if pkgconfig then + return pkgconfig.program + end +end -- get version -- @@ -34,7 +42,7 @@ import("detect.tools.find_pkg_config") function version(name, opt) -- attempt to add search paths from pkg-config - local pkgconfig = find_pkg_config() + local pkgconfig = _get_pkgconfig() if not pkgconfig then return end @@ -46,7 +54,7 @@ function version(name, opt) local configdirs_old = os.getenv("PKG_CONFIG_PATH") local configdirs = table.wrap(opt.configdirs) if #configdirs > 0 then - os.setenv("PKG_CONFIG_PATH", unpack(configdirs)) + os.setenv("PKG_CONFIG_PATH", table.unpack(configdirs)) end -- get version @@ -73,7 +81,7 @@ end function variables(name, variables, opt) -- attempt to add search paths from pkg-config - local pkgconfig = find_pkg_config() + local pkgconfig = _get_pkgconfig() if not pkgconfig then return end @@ -85,7 +93,7 @@ function variables(name, variables, opt) local configdirs_old = os.getenv("PKG_CONFIG_PATH") local configdirs = table.wrap(opt.configdirs) if #configdirs > 0 then - os.setenv("PKG_CONFIG_PATH", unpack(configdirs)) + os.setenv("PKG_CONFIG_PATH", table.unpack(configdirs)) end -- get variable value @@ -125,7 +133,7 @@ end function libinfo(name, opt) -- attempt to add search paths from pkg-config - local pkgconfig = find_pkg_config() + local pkgconfig = _get_pkgconfig() if not pkgconfig then return end |
