summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2022-12-16 12:33:32 +0100
committerArthur LAURENT <[email protected]>2022-12-16 12:47:46 +0100
commit47d2cdfee41bd746b7d41e941c9da2a679cc65ea (patch)
tree6582d431debf1d25dd24f3920e0952fd8c9af6a8 /xmake/rules/c++/modules
parentedcda9c35c05a90c1e6e110b559de69d78d1cc06 (diff)
improve modules_support/msvc.lua
Diffstat (limited to 'xmake/rules/c++/modules')
-rw-r--r--xmake/rules/c++/modules/modules_support/msvc.lua21
1 files changed, 10 insertions, 11 deletions
diff --git a/xmake/rules/c++/modules/modules_support/msvc.lua b/xmake/rules/c++/modules/modules_support/msvc.lua
index 8a099de17..6d7504e6b 100644
--- a/xmake/rules/c++/modules/modules_support/msvc.lua
+++ b/xmake/rules/c++/modules/modules_support/msvc.lua
@@ -130,16 +130,15 @@ function load(target)
-- enable std modules if c++23 by defaults
if target:values("c++.msvc.enable_std_import") == nil then
- local languages = table.join({}, target:get("languages"))
- local iscpp23 = false
- for _, language in pairs(languages) do
- if language:find("c++") or language:find("cxx") then
- iscpp23 = true
- for _, version in pairs({"11", "14", "17", "20"}) do
- if language:find(version) then
- iscpp23 = false
- break
- end
+ local languages = target:get("languages")
+ local isatleastcpp23 = false
+ for _, language in ipairs(languages) do
+ if language:startswith("c++") or language:startswith("cxx") then
+ isatleastcpp23 = true
+ local version = tonumber(language:match("%d+"))
+ if not version or version <= 20 then
+ isatleastcpp23 = false
+ break
end
end
end
@@ -151,7 +150,7 @@ function load(target)
stdmodulesdir = path.join(vcvars.VCInstallDir, "Tools", "MSVC", vcvars.VCToolsVersion, "modules")
end
end
- target:set("values", "c++.msvc.enable_std_import", iscpp23 and os.isdir(stdmodulesdir))
+ target:set("values", "c++.msvc.enable_std_import", isatleastcpp23 and os.isdir(stdmodulesdir))
end
end