diff options
| author | ruki <[email protected]> | 2021-11-28 13:36:54 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-11-28 13:36:54 +0800 |
| commit | 6a315bad9fd1370c41ddd0f6cd48ae51dbf0d3f9 (patch) | |
| tree | ca751702a5e42a9ec132314f6ac17dbac23add59 /xmake/core/package | |
| parent | 3726f42847029c73301a87937e80a9c78465fdb2 (diff) | |
add has_tool
Diffstat (limited to 'xmake/core/package')
| -rw-r--r-- | xmake/core/package/package.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 2d7534878..d47858e55 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -845,6 +845,22 @@ function _instance:toolconfig(name) end end +-- has the given tool for the current package? +-- +-- e.g. +-- +-- if package:has_tool("cc", "clang", "gcc") then +-- ... +-- end +function _instance:has_tool(toolkind, ...) + local _, toolname = self:tool(toolkind) + for _, v in ipairs(table.join(...)) do + if v and toolname:find("^" .. v:gsub("%-", "%%-") .. "$") then + return true + end + end +end + -- get the user private data function _instance:data(name) return self._DATA and self._DATA[name] or nil |
