diff options
| author | ruki <[email protected]> | 2019-01-24 00:48:14 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-01-23 22:49:27 +0800 |
| commit | dae284b933cea7f3717a5a0dee3f18304b3fb1e0 (patch) | |
| tree | 4c8e23bb698b570ff5d150f9004106384ff1c359 /xmake/modules/detect/packages/find_pcre.lua | |
| parent | 7d9fe778c235da802039bf46c62cd4142f4719e4 (diff) | |
improve lib.detect.find_package
Diffstat (limited to 'xmake/modules/detect/packages/find_pcre.lua')
| -rw-r--r-- | xmake/modules/detect/packages/find_pcre.lua | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/xmake/modules/detect/packages/find_pcre.lua b/xmake/modules/detect/packages/find_pcre.lua index 149f29c90..f109673f4 100644 --- a/xmake/modules/detect/packages/find_pcre.lua +++ b/xmake/modules/detect/packages/find_pcre.lua @@ -23,8 +23,7 @@ -- -- imports -import("lib.detect.vcpkg") -import("lib.detect.pkg_config") +import("package.manager.find_package") -- find pcre -- @@ -34,28 +33,17 @@ import("lib.detect.pkg_config") -- function main(opt) - -- find package from vcpkg first - local result = vcpkg.find("pcre", opt) - if result then - local links = {} - for _, link in ipairs(result.links) do - links[link] = true - end - for _, width in ipairs({"", "16", "32"}) do - if links["pcre" .. width] then - result.links = {"pcre" .. width} - return result - end - end - end + -- find package by the builtin script + local result = opt.find_package("pcre", opt) - -- find package from the current host platform - if opt.plat == os.host() and opt.arch == os.arch() then + -- find package from the homebrew package manager + if not result and opt.plat == os.host() and opt.arch == os.arch() then for _, width in ipairs({"", "16", "32"}) do - local result = pkg_config.find("libpcre" .. width, {brewhint = "pcre"}) + result = find_package("brew::pcre/libpcre" .. width, opt) if result then - return result + break end end end + return result end |
