summaryrefslogtreecommitdiff
path: root/xmake/modules/private/utils/target.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-09-26 00:54:26 +0800
committerruki <[email protected]>2025-09-26 00:54:26 +0800
commitb5eaedb26c78ee4afa4641c78579ff1e65450d6d (patch)
tree292a11c773bb0943145cea5e918ddc005766c1eb /xmake/modules/private/utils/target.lua
parent41071f11cb134a124734b922fe51ef6d8f5cfc20 (diff)
fix check cxxflags
Diffstat (limited to 'xmake/modules/private/utils/target.lua')
-rw-r--r--xmake/modules/private/utils/target.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/xmake/modules/private/utils/target.lua b/xmake/modules/private/utils/target.lua
index 67fb79577..ad6046b44 100644
--- a/xmake/modules/private/utils/target.lua
+++ b/xmake/modules/private/utils/target.lua
@@ -23,8 +23,7 @@ import("core.base.option")
import("core.project.project")
-- Is this target has these tools?
-function has_tool(target, toolkind, ...)
- local _, toolname = target:tool(toolkind)
+function has_tool(toolname, tools)
if toolname then
-- We need compatibility with gcc/g++, clang/clang++ for c++ compiler/linker
-- @see https://github.com/xmake-io/xmake/issues/6852
@@ -33,7 +32,7 @@ function has_tool(target, toolkind, ...)
toolname = toolname:rtrim("xx")
trim_xx = true
end
- for _, v in ipairs(table.pack(...)) do
+ for _, v in ipairs(tools) do
if trim_xx then
v = v:rtrim("xx")
end
@@ -42,6 +41,7 @@ function has_tool(target, toolkind, ...)
end
end
end
+ return false
end
-- does this flag belong to this tool?
@@ -71,7 +71,7 @@ function flag_belong_to_tool(flag, toolinst, extraconf)
for_this_tool = true
end
elseif flagconf and flagconf.tools then
- for_this_tool = table.contains(table.wrap(flagconf.tools), toolinst:name())
+ for_this_tool = has_tool(toolinst:name(), flagconf.tools)
end
if for_this_tool then
return flag