diff options
| author | ruki <[email protected]> | 2020-09-04 22:53:41 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-09-04 22:53:41 +0800 |
| commit | 6d94dd1d7ae4b19977fddef3396b454235f6a6f1 (patch) | |
| tree | ad98079a8a3400b053451200e4aa1ae056626416 /xmake/modules/lib/detect | |
| parent | 304cd31298a66501aecec161c31f5e94aa5ac142 (diff) | |
improve pkg_config.find_package
Diffstat (limited to 'xmake/modules/lib/detect')
| -rw-r--r-- | xmake/modules/lib/detect/pkg_config.lua | 61 |
1 files changed, 1 insertions, 60 deletions
diff --git a/xmake/modules/lib/detect/pkg_config.lua b/xmake/modules/lib/detect/pkg_config.lua index f6c8f74be..4935f0c1e 100644 --- a/xmake/modules/lib/detect/pkg_config.lua +++ b/xmake/modules/lib/detect/pkg_config.lua @@ -151,7 +151,7 @@ function libinfo(name, opt) -- get links local link = flag:match("%-l(.*)") - if link then + if link and not link:find(path.sep(), 1, true) then result.links = result.links or {} table.insert(result.links, link) end @@ -190,62 +190,3 @@ function libinfo(name, opt) return result end --- find package --- --- @param name the package name --- @param opt the argument options, {plat = "", arch = "", links = {...}} --- --- @return {links = {"ssl", "crypto", "z"}, linkdirs = {""}, includedirs = {""}} --- --- @code --- --- local libinfo = pkg_config.find("openssl") --- --- @endcode --- -function find(name, opt) - - -- init options - opt = opt or {} - - -- get library info - local libinfo = libinfo(name, opt) - if not libinfo then - return - end - - -- get links - local links = libinfo.links - if not links or #links == 0 then - links = opt.links - end - - -- find library - local result = nil - local linkdirs = table.wrap(libinfo.linkdirs) - for _, link in ipairs(links) do - local libinfo = find_library(link, linkdirs) - if libinfo then - result = result or {} - result.links = table.join(result.links or {}, libinfo.link) - result.linkdirs = table.join(result.linkdirs or {}, libinfo.linkdir) - end - end - if result and result.links then - result.linkdirs = table.unique(result.linkdirs) - end - - -- get includedirs - if libinfo.includedirs then - result = result or {} - result.includedirs = libinfo.includedirs - end - - -- save version - if result and libinfo.version then - result.version = libinfo.version - end - - -- ok? - return result -end |
