summaryrefslogtreecommitdiff
path: root/xmake/core/language/language.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/core/language/language.lua')
-rw-r--r--xmake/core/language/language.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/xmake/core/language/language.lua b/xmake/core/language/language.lua
index 8bf9395ae..4aa10c5e4 100644
--- a/xmake/core/language/language.lua
+++ b/xmake/core/language/language.lua
@@ -561,6 +561,19 @@ function language.sourcekind_of(sourcefile)
return sourcekind
end
+-- get extension of the source kind
+function language.extension_of(sourcekind)
+
+ -- get extension
+ local extension = table.wrap(language.sourcekinds()[sourcekind])[1]
+ if not extension then
+ return nil, string.format("%s is unknown source kind", sourcekind)
+ end
+
+ -- ok
+ return extension
+end
+
-- get linker infos(kind and flag) of the target kind and the source kinds
function language.linkerinfos_of(targetkind, sourcekinds)