summaryrefslogtreecommitdiff
path: root/xmake/core/project/target.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/core/project/target.lua')
-rw-r--r--xmake/core/project/target.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 5e67d0f7e..b466c9e2e 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -465,11 +465,18 @@ function _instance:version()
end
end
end
-
- -- ok?
return version, version_build
end
+-- get the target policy
+function _instance:policy(name)
+ local policies = self:get("policy")
+ if policies then
+ local value = policies[name]
+ return value and table.unwrap(value)
+ end
+end
+
-- get the base name of target file
function _instance:basename()
local filename = self:get("filename")
@@ -1669,6 +1676,7 @@ function target.apis()
, "target.set_configvar"
, "target.set_runenv"
, "target.set_toolchain"
+ , "target.set_policy"
-- target.add_xxx
, "target.add_values"
, "target.add_runenvs"