summaryrefslogtreecommitdiff
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
parent41071f11cb134a124734b922fe51ef6d8f5cfc20 (diff)
fix check cxxflags
-rw-r--r--xmake/core/package/package.lua3
-rw-r--r--xmake/core/project/target.lua3
-rw-r--r--xmake/modules/private/utils/target.lua8
3 files changed, 8 insertions, 6 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 0eec73407..663f7d3a0 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -1413,7 +1413,8 @@ function _instance:has_tool(toolkind, ...)
target_utils = sandbox_module.import("private.utils.target", {anonymous = true})
target._target_utils = target_utils
end
- return target_utils.has_tool(self, toolkind, ...)
+ local _, toolname = self:tool(toolkind)
+ return target_utils.has_tool(toolname, table.pack(...))
end
-- get the user private data
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 73d53cbe6..3839eb01f 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -2683,7 +2683,8 @@ function _instance:has_tool(toolkind, ...)
target_utils = sandbox_module.import("private.utils.target", {anonymous = true})
target._target_utils = target_utils
end
- return target_utils.has_tool(self, toolkind, ...)
+ local _, toolname = self:tool(toolkind)
+ return target_utils.has_tool(toolname, table.pack(...))
end
-- has the given c funcs?
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