summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/modules_support/clang.lua
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2022-11-30 23:34:45 +0100
committerArthur LAURENT <[email protected]>2022-11-30 23:34:45 +0100
commit97c36a86e182c2fcac292275badf2cd231eb8640 (patch)
tree17109ef162f0621ceb2a54454684f48c3cad3726 /xmake/rules/c++/modules/modules_support/clang.lua
parent7735eb5da1f03fa0fc3152cfc4901daf3cad9845 (diff)
Add defines to clang and gcc
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/clang.lua')
-rw-r--r--xmake/rules/c++/modules/modules_support/clang.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/xmake/rules/c++/modules/modules_support/clang.lua b/xmake/rules/c++/modules/modules_support/clang.lua
index 160c08b25..6e6a7cb89 100644
--- a/xmake/rules/c++/modules/modules_support/clang.lua
+++ b/xmake/rules/c++/modules/modules_support/clang.lua
@@ -152,8 +152,12 @@ function generate_dependencies(target, sourcebatch, opt)
local jsonfile = path.translate(path.join(outputdir, path.filename(sourcefile) .. ".json"))
common.fallback_generate_dependencies(target, jsonfile, sourcefile, function(file)
local compinst = target:compiler("cxx")
+ local defines = {}
+ for _, define in ipairs(target:get("defines")) do
+ table.insert(defines, "-D" .. define)
+ end
local ifile = path.translate(path.join(outputdir, path.filename(file) .. ".i"))
- os.vrunv(compinst:program(), {"-E", "-x", "c++", file, "-o", ifile})
+ os.vrunv(compinst:program(), table.join(defines, {"-E", "-x", "c++", file, "-o", ifile}))
return io.readfile(ifile)
end)
changed = true