diff options
| author | ruki <[email protected]> | 2017-06-13 10:35:12 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-06-13 10:35:12 +0800 |
| commit | a1304d43b58dcd7f0ee3a822781af8f67def640f (patch) | |
| tree | 04b7d6a1f4a1f427f46c6719310b5e5b6293705c /xmake/modules/lib/detect/pkg_config.lua | |
| parent | 3c2de8ed5b50203ebed47f774c51792ee8c4ae80 (diff) | |
match version for find_package()
Diffstat (limited to 'xmake/modules/lib/detect/pkg_config.lua')
| -rw-r--r-- | xmake/modules/lib/detect/pkg_config.lua | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/xmake/modules/lib/detect/pkg_config.lua b/xmake/modules/lib/detect/pkg_config.lua index 15cb2a391..5b595b50d 100644 --- a/xmake/modules/lib/detect/pkg_config.lua +++ b/xmake/modules/lib/detect/pkg_config.lua @@ -118,7 +118,7 @@ function info(name, opt) local version = try { function() return os.iorunv(pkg_config, {"--modversion", name}) end } if version then result = result or {} - result.version = version + result.version = version:trim() end end @@ -137,9 +137,9 @@ end -- find package -- -- @param name the package name --- @param opt the argument options, {version = true} +-- @param opt the argument options, {plat = "", arch = "", version = "1.0.1"} -- --- @return {links = {"ssl", "crypto", "z"}, linkdirs = {""}, includedirs = {""}, version = ""} +-- @return {links = {"ssl", "crypto", "z"}, linkdirs = {""}, includedirs = {""}} -- -- @code -- @@ -154,6 +154,12 @@ function find(name, opt) if not pkginfo then return end + + -- match version? + opt = opt or {} + if opt.version and pkginfo.version ~= opt.version then + return + end -- find library local result = nil @@ -168,7 +174,6 @@ function find(name, opt) -- found? if result and result.links then - result.version = pkginfo.version result.linkdirs = table.unique(result.linkdirs) result.includedirs = table.join(result.includedirs or {}, pkginfo.includedirs) end |
