summaryrefslogtreecommitdiff
path: root/xmake/core/project/target.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2023-03-18 00:37:10 +0800
committerruki <[email protected]>2023-03-18 00:37:10 +0800
commit21f980d98c09362721ccd48f42a6fa5508cf4375 (patch)
tree2565eb5dc7d9ee075e698236ffb989889bb30081 /xmake/core/project/target.lua
parent0d2f106b0d7304e352dc830f5d325fb6619c32be (diff)
add has_features
Diffstat (limited to 'xmake/core/project/target.lua')
-rw-r--r--xmake/core/project/target.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index dfcf58a56..549f18301 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -2354,6 +2354,19 @@ function _instance:has_cxxflags(flags, opt)
return compinst:has_flags(flags, "cxxflags", opt)
end
+-- has the given features?
+--
+-- @param features the features, e.g. {"c_static_assert", "cxx_constexpr"}
+-- @param opt the argument options, e.g. {cxflags = "", defines = "", includedirs = "", ...}
+--
+-- @return true or false, errors
+--
+function _instance:has_features(features, opt)
+ opt = opt or {}
+ opt.target = self
+ return sandbox_module.import("core.tool.compiler", {anonymous = true}).has_features(features, opt)
+end
+
-- check the given c snippets?
--
-- @param snippets the snippets