summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/xmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2023-01-06 22:33:08 +0800
committerruki <[email protected]>2023-01-06 22:33:08 +0800
commitaca51a2079ecdb010085d954c04b5aa5b11d3ed1 (patch)
tree9fb82c9ffcd3d93040d31daaf8883592b2bf63ac /xmake/rules/c++/modules/xmake.lua
parente8bb34d2e8f1c567a6a6bb70b060a67ccb232e3d (diff)
improve c++ modules
Diffstat (limited to 'xmake/rules/c++/modules/xmake.lua')
-rw-r--r--xmake/rules/c++/modules/xmake.lua19
1 files changed, 13 insertions, 6 deletions
diff --git a/xmake/rules/c++/modules/xmake.lua b/xmake/rules/c++/modules/xmake.lua
index 315385824..3a7c7129d 100644
--- a/xmake/rules/c++/modules/xmake.lua
+++ b/xmake/rules/c++/modules/xmake.lua
@@ -115,18 +115,25 @@ rule("c++.build.modules.builder")
before_link(function (target)
import("modules_support.common")
- common.append_dependency_objectfiles(target)
+ if target:data("cxx.has_modules") then
+ common.append_dependency_objectfiles(target)
+ end
end)
after_clean(function (target)
import("core.base.option")
import("modules_support.common")
import("private.action.clean.remove_files")
- remove_files(common.modules_cachedir(target))
- if option.get("all") then
- remove_files(common.stlmodules_cachedir(target))
- common.localcache():clear()
- common.localcache():save()
+
+ -- we cannot use target:data("cxx.has_modules"),
+ -- because on_config will be not called when cleaning targets
+ if common.contains_modules(target) then
+ remove_files(common.modules_cachedir(target))
+ if option.get("all") then
+ remove_files(common.stlmodules_cachedir(target))
+ common.localcache():clear()
+ common.localcache():save()
+ end
end
end)