From a9ed54fd3af64a04bb7d617a51dde689d23c80de Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Wed, 3 Aug 2022 03:32:16 +0200 Subject: [C++20 Modules] Move contains_modules function into common.lua --- xmake/rules/c++/modules/modules_support/common.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'xmake/rules/c++/modules/modules_support/common.lua') diff --git a/xmake/rules/c++/modules/modules_support/common.lua b/xmake/rules/c++/modules/modules_support/common.lua index 7df0b3d34..ca637cbf2 100644 --- a/xmake/rules/c++/modules/modules_support/common.lua +++ b/xmake/rules/c++/modules/modules_support/common.lua @@ -163,6 +163,18 @@ function modules_support(target) return module_builder end +function contains_modules(target) + local target_with_modules + for _, dep in ipairs(target:orderdeps()) do + local sourcebatches = dep:sourcebatches() + if sourcebatches and sourcebatches["c++.build.modules"] then + target_with_modules = true + break + end + end + return target_with_modules +end + function load(target, sourcebatch, opt) local cachedir = get_cache_dir(target) -- cgit v1.3.1