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/project/target.lua | |
| parent | 3726f42847029c73301a87937e80a9c78465fdb2 (diff) | |
add has_tool
Diffstat (limited to 'xmake/core/project/target.lua')
| -rw-r--r-- | xmake/core/project/target.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 572764c90..499db099c 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -1951,6 +1951,22 @@ function _instance:toolconfig(name) end}) end +-- has the given tool for the current target? +-- +-- e.g. +-- +-- if target: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 target apis function target.apis() |
